/
webpack.config.js
35 lines (32 loc) · 1.02 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
const path = require("path");
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
var PROD = (process.env.NODE_ENV === "production");
var WEB = (process.env.USE_ENV === "web");
module.exports = {
entry: "./lib/big-decimal",
target: [WEB ? "web" : "node", "es5"],
output: {
filename: "bundle.js",
path: WEB ? path.resolve(__dirname, "dist/web") : path.resolve(__dirname, "dist/node"),
library: "bigDecimal",
libraryTarget: WEB ? "var" : "umd",
filename: PROD ? "js-big-decimal.min.js" : "js-big-decimal.js"
},
resolve: {
extensions: [".webpack.js", ".web.js", ".ts", ".js"]
},
optimization: {
minimizer: PROD ? [
new TerserPlugin({
terserOptions: {
ecma: undefined,
warnings: false,
sourceMap: true,
mangle: true,
keep_classnames: true
},
})
] : []
}
}