Skip to content

Commit 019a7fb

Browse files
committed
update webpack configuration
1 parent 6e91f7e commit 019a7fb

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

webpack.config.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
const webpack = require('webpack');
2-
const path = require('path');
3-
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
1+
const webpack = require("webpack");
2+
const path = require("path");
3+
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
44

5-
module.exports = (env => {
5+
module.exports = env => {
66

77
if (!env) env = { production: false, karma: false };
88

99
let mode = env.production ? "production" : "development";
1010
let tsconfig = !env.karma ? "tsconfig.json" : "tsconfig.test.json";
11-
let output = env.production ? "dist" : "dev";
11+
let output = env.production ? "dist" : "dist-test";
1212
let filename = env.production ? "robotlegs-signalcommandmap.min.js" : "robotlegs-signalcommandmap.js";
1313

1414
return {
1515
mode: mode,
16+
1617
entry: {
1718
main: path.join(__dirname, "src/index.ts")
1819
},
@@ -48,12 +49,32 @@ module.exports = (env => {
4849

4950
plugins: (
5051
(env.production)
51-
? [ new UglifyJSPlugin() ]
52+
? []
5253
: [ new webpack.SourceMapDevToolPlugin({ test: /\.ts$/i }) ]
5354
),
5455

56+
optimization:
57+
(env.production)
58+
? {
59+
concatenateModules: true,
60+
minimize: true,
61+
minimizer: [
62+
new UglifyJsPlugin({
63+
cache: true,
64+
parallel: 4,
65+
uglifyOptions: {
66+
output: {
67+
comments: false
68+
}
69+
}
70+
})
71+
]
72+
}
73+
: {}
74+
,
75+
5576
resolve: {
56-
extensions: ['.ts', '.js', '.json']
77+
extensions: [".ts", ".js", ".json"]
5778
}
5879
}
59-
});
80+
};

0 commit comments

Comments
 (0)