diff --git a/package.json b/package.json index f43fb2752..04a6f6994 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/support/prod.config.js b/support/prod.config.js new file mode 100644 index 000000000..907f4706c --- /dev/null +++ b/support/prod.config.js @@ -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" + } + ] + } +}; diff --git a/support/webpack.config.js b/support/webpack.config.js index 42d8f7f42..111c8319f 100644 --- a/support/webpack.config.js +++ b/support/webpack.config.js @@ -24,7 +24,7 @@ module.exports = { } })()` }, - mode: "production", + mode: "development", node: { Buffer: false }, diff --git a/test/support/public/worker.js b/test/support/public/worker.js index 91ee6a008..7248a0fd1 100644 --- a/test/support/public/worker.js +++ b/test/support/public/worker.js @@ -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(); diff --git a/test/support/server.js b/test/support/server.js index cf75591ad..3d42afe5b 100644 --- a/test/support/server.js +++ b/test/support/server.js @@ -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");