-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
58 lines (55 loc) · 1.31 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
const DuplicatePackageCheckerPlugin = require("duplicate-package-checker-webpack-plugin");
const path = require("path");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const config = {
entry: "./src",
output: {
filename: "jcc-wallet.min.js",
path: path.resolve(__dirname, "./dist"),
library: "jcc_wallet",
libraryTarget: "umd"
},
target: "web",
resolve: {
extensions: [".js", ".ts"],
fallback: {
tls: false,
net: false,
fs: false,
child_process: false
}
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false
})
]
},
mode: process.env.MODE === "dev" ? "development" : "production",
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: "ts-loader"
},
{
test: /\.(cjs|mjs|js|jsx)$/,
loader: "babel-loader"
}
]
},
plugins: [
new DuplicatePackageCheckerPlugin(),
new NodePolyfillPlugin({
excludeAliases: ["process", "console", "crypto"]
})
]
};
if (process.env.REPORT === "true") {
config.plugins.push(new BundleAnalyzerPlugin());
}
module.exports = config;