@@ -3,7 +3,7 @@ const path = require("path");
33const rimraf = require ( "rimraf" ) ;
44const webpack = require ( "webpack" ) ;
55const CopyPlugin = require ( "copy-webpack-plugin" ) ;
6- const UglifyJsPlugin = require ( "uglifyjs -webpack-plugin" ) ;
6+ const TerserPlugin = require ( "terser -webpack-plugin" ) ;
77const { CleanWebpackPlugin } = require ( "clean-webpack-plugin" ) ;
88const { 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+ / w e b p x m u x \. j s / ,
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 : / \. m i n \. j s $ / ,
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