Skip to content

Commit

Permalink
chore: provide a development bundle
Browse files Browse the repository at this point in the history
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
  • Loading branch information
darrachequesne committed Sep 10, 2020
1 parent f7ba966 commit 4683a95
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"test": "npm run lint && npm run format:check && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi",
"test:node": "mocha --reporter dot --require test/support/server.js test/index.js",
"test:browser": "zuul test/index.js",
"build": "webpack --config ./support/webpack.config.js",
"build": "webpack --config ./support/webpack.config.js --config ./support/prod.config.js",
"format:check": "prettier --check 'lib/**/*.js' 'test/**/*.js' 'support/**/*.js'",
"format:fix": "prettier --write 'lib/**/*.js' 'test/**/*.js' 'support/**/*.js'",
"lint": "eslint lib/**/*.js test/**/*.js"
Expand Down
19 changes: 19 additions & 0 deletions support/prod.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const config = require("./webpack.config");

module.exports = {
...config,
output: {
...config.output,
filename: "engine.io.min.js"
},
mode: "production",
module: {
rules: [
...config.module.rules,
{
test: /\.js$/,
loader: "webpack-remove-debug"
}
]
}
};
2 changes: 1 addition & 1 deletion support/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
}
})()`
},
mode: "production",
mode: "development",
node: {
Buffer: false
},
Expand Down
2 changes: 1 addition & 1 deletion test/support/public/worker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global importScripts,eio,postMessage */

importScripts("/test/support/engine.io.js");
importScripts("/test/support/engine.io.min.js");

var socket = new eio.Socket();

Expand Down
2 changes: 1 addition & 1 deletion test/support/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var server = require("engine.io").attach(http, { pingInterval: 500 });
var webpack = require("webpack");
const path = require("path");

var webpackConfig = require("../../support/webpack.config.js");
var webpackConfig = require("../../support/prod.config.js");

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

Expand Down

0 comments on commit 4683a95

Please sign in to comment.