Skip to content

Commit

Permalink
Merge pull request #925 from ml5js/bomani.development-build-port
Browse files Browse the repository at this point in the history
Specify webpack-dev-server port
  • Loading branch information
joeyklee authored Apr 21, 2020
2 parents e2f166c + 2469c00 commit e9f053a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions webpack.common.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { join, resolve } from 'path';
const include = join(__dirname, 'src');

export const indexEntryWithBabel = ['babel-polyfill', './src/index.js'];
export const developmentPort = 8080;

export default {
name: 'ml5',
Expand Down
3 changes: 2 additions & 1 deletion webpack.dev.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { join } from 'path';
import merge from 'webpack-merge';
import common from './webpack.common.babel';
import common, {developmentPort} from './webpack.common.babel';
import HtmlWebpackPlugin from 'html-webpack-plugin';

export default merge(common, {
Expand All @@ -15,6 +15,7 @@ export default merge(common, {
watchContentBase: true,
contentBase: join(__dirname, './dist'),
disableHostCheck: true,
port: developmentPort,
},
plugins: [
new HtmlWebpackPlugin({
Expand Down
4 changes: 2 additions & 2 deletions webpack.prod.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import merge from 'webpack-merge';
import { resolve } from 'path';
import common, {indexEntryWithBabel} from './webpack.common.babel';
import common, {indexEntryWithBabel, developmentPort} from './webpack.common.babel';
import UglifyJSPlugin from 'uglifyjs-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';

Expand All @@ -15,7 +15,7 @@ const replaceML5Reference = (content, path) => {
return content;
}

return content.toString().replace('http://localhost:8080/ml5.js', 'https://unpkg.com/ml5@latest/dist/ml5.min.js');
return content.toString().replace(`http://localhost:${developmentPort}/ml5.js`, 'https://unpkg.com/ml5@latest/dist/ml5.min.js');
}

const libraryBuildConfig = merge(common, {
Expand Down
4 changes: 2 additions & 2 deletions webpack.test.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { existsSync, mkdirSync, writeFileSync, lstatSync } from 'fs';
import { join } from 'path';
import assert from 'assert';
import merge from 'webpack-merge';
import common from './webpack.common.babel';
import common, {developmentPort} from './webpack.common.babel';

// this is the function to initialize manual-test folder when running `npm run start`
(function checkExperimentsFolder() {
Expand All @@ -27,7 +27,7 @@ import common from './webpack.common.babel';
<html>
<head>
<title>ml5.js manual test</title>
<script src="http://localhost:8080/ml5.js"></script>
<script src="http://localhost:${developmentPort}/ml5.js"></script>
</head>
<body>
<script>
Expand Down

0 comments on commit e9f053a

Please sign in to comment.