-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
62 lines (58 loc) · 1.46 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin");
const path = require("path");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const config = {
entry: "./lib/abi",
output: {
filename: "jcc-moac-abi.min.js",
path: path.resolve(__dirname, "./dist"),
library: "jcc_moac_abi",
libraryTarget: "umd"
},
target: "web",
resolve: {
extensions: [".js", ".ts"],
alias: {
"bn.js": path.resolve(__dirname, "node_modules/bn.js"),
"inherits": path.resolve(__dirname, "node_modules/inherits"),
"utf8": path.resolve(__dirname, "node_modules/utf8")
}
},
mode: process.env.MODE === "dev" ? 'development' : "production",
node: {
fs: "empty",
tls: "empty",
"child_process": "empty",
net: "empty"
},
module: {
rules: [{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/
}]
},
plugins: [
new DuplicatePackageCheckerPlugin()
]
};
if (process.env.REPORT === "true") {
config.plugins.push(new BundleAnalyzerPlugin())
}
if (process.env.MODE !== "dev") {
config.plugins.push(new UglifyJsPlugin({
uglifyOptions: {
compress: {
sequences: true,
dead_code: true,
drop_console: true,
drop_debugger: true,
unused: true
}
},
sourceMap: false,
parallel: true
}));
}
module.exports = config;