Skip to content

Commit 496d22d

Browse files
committed
Updated the Webpack config
1 parent 9facff7 commit 496d22d

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

webpack.config.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require("path");
33
const rimraf = require("rimraf");
44
const webpack = require("webpack");
55
const CopyPlugin = require("copy-webpack-plugin");
6-
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
6+
const TerserPlugin = require("terser-webpack-plugin");
77
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
88
const { WebpackCompilerPlugin } = require("webpack-compiler-plugin");
99

@@ -31,13 +31,16 @@ module.exports = {
3131
extensions: [".ts", ".js"],
3232
},
3333
target: "web",
34-
externals: { fs: "commonjs fs", ws: "commonjs ws" },
3534
plugins: [
3635
new webpack.ProgressPlugin(),
3736
new CleanWebpackPlugin(),
37+
new webpack.NormalModuleReplacementPlugin(
38+
/webpxmux\.js/,
39+
'webpxmux-web.js'
40+
),
3841
new CopyPlugin({
3942
patterns: [{ from: "build/webpxmux.wasm", to: "." }],
40-
}),
43+
}),
4144
new WebpackCompilerPlugin({
4245
name: "CleanupCompilerPlugin",
4346
listeners: {
@@ -62,13 +65,23 @@ module.exports = {
6265
optimization: {
6366
minimize: true,
6467
minimizer: [
65-
new UglifyJsPlugin({
68+
new TerserPlugin({
6669
include: /\.min\.js$/,
6770
sourceMap: true,
71+
terserOptions: {
72+
compress: {
73+
dead_code: true,
74+
conditionals: true,
75+
},
76+
},
6877
}),
6978
],
7079
},
7180
stats: {
72-
warningsFilter: ["entrypoint size limit", "asset size limit", "limit the size"],
81+
warningsFilter: [
82+
"entrypoint size limit",
83+
"asset size limit",
84+
"limit the size",
85+
],
7386
},
7487
};

0 commit comments

Comments
 (0)