Skip to content

Commit 4683a95

Browse files
chore: provide a development bundle
Two bundles will now be created: - one for development, with debug and unminified: dist/engine.io.js - one for production, without debug and minified: dist/engine.io.min.js
1 parent f7ba966 commit 4683a95

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"test": "npm run lint && npm run format:check && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi",
6262
"test:node": "mocha --reporter dot --require test/support/server.js test/index.js",
6363
"test:browser": "zuul test/index.js",
64-
"build": "webpack --config ./support/webpack.config.js",
64+
"build": "webpack --config ./support/webpack.config.js --config ./support/prod.config.js",
6565
"format:check": "prettier --check 'lib/**/*.js' 'test/**/*.js' 'support/**/*.js'",
6666
"format:fix": "prettier --write 'lib/**/*.js' 'test/**/*.js' 'support/**/*.js'",
6767
"lint": "eslint lib/**/*.js test/**/*.js"

support/prod.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const config = require("./webpack.config");
2+
3+
module.exports = {
4+
...config,
5+
output: {
6+
...config.output,
7+
filename: "engine.io.min.js"
8+
},
9+
mode: "production",
10+
module: {
11+
rules: [
12+
...config.module.rules,
13+
{
14+
test: /\.js$/,
15+
loader: "webpack-remove-debug"
16+
}
17+
]
18+
}
19+
};

support/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
}
2525
})()`
2626
},
27-
mode: "production",
27+
mode: "development",
2828
node: {
2929
Buffer: false
3030
},

test/support/public/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* global importScripts,eio,postMessage */
22

3-
importScripts("/test/support/engine.io.js");
3+
importScripts("/test/support/engine.io.min.js");
44

55
var socket = new eio.Socket();
66

test/support/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var server = require("engine.io").attach(http, { pingInterval: 500 });
88
var webpack = require("webpack");
99
const path = require("path");
1010

11-
var webpackConfig = require("../../support/webpack.config.js");
11+
var webpackConfig = require("../../support/prod.config.js");
1212

1313
webpackConfig.output.path = path.resolve(__dirname, "public");
1414

0 commit comments

Comments
 (0)