Skip to content

Commit e9f053a

Browse files
authored
Merge pull request #925 from ml5js/bomani.development-build-port
Specify webpack-dev-server port
2 parents e2f166c + 2469c00 commit e9f053a

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

webpack.common.babel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { join, resolve } from 'path';
88
const include = join(__dirname, 'src');
99

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

1213
export default {
1314
name: 'ml5',

webpack.dev.babel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { join } from 'path';
77
import merge from 'webpack-merge';
8-
import common from './webpack.common.babel';
8+
import common, {developmentPort} from './webpack.common.babel';
99
import HtmlWebpackPlugin from 'html-webpack-plugin';
1010

1111
export default merge(common, {
@@ -15,6 +15,7 @@ export default merge(common, {
1515
watchContentBase: true,
1616
contentBase: join(__dirname, './dist'),
1717
disableHostCheck: true,
18+
port: developmentPort,
1819
},
1920
plugins: [
2021
new HtmlWebpackPlugin({

webpack.prod.babel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import merge from 'webpack-merge';
77
import { resolve } from 'path';
8-
import common, {indexEntryWithBabel} from './webpack.common.babel';
8+
import common, {indexEntryWithBabel, developmentPort} from './webpack.common.babel';
99
import UglifyJSPlugin from 'uglifyjs-webpack-plugin';
1010
import CopyPlugin from 'copy-webpack-plugin';
1111

@@ -15,7 +15,7 @@ const replaceML5Reference = (content, path) => {
1515
return content;
1616
}
1717

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

2121
const libraryBuildConfig = merge(common, {

webpack.test.babel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { existsSync, mkdirSync, writeFileSync, lstatSync } from 'fs';
77
import { join } from 'path';
88
import assert from 'assert';
99
import merge from 'webpack-merge';
10-
import common from './webpack.common.babel';
10+
import common, {developmentPort} from './webpack.common.babel';
1111

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

0 commit comments

Comments
 (0)