-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
81 lines (76 loc) · 1.5 KB
/
webpack.config.js
File metadata and controls
81 lines (76 loc) · 1.5 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const GasPlugin = require("gas-webpack-plugin");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const path = require("path");
const basePath = __dirname;
const presets = [
["@babel/preset-typescript"],
[
"@babel/preset-env",
{
targets: {
browsers: ["ie >= 9"]
},
useBuiltIns: "usage",
modules: "commonjs",
debug: false
}
]
];
const uglify = new UglifyJSPlugin({
uglifyOptions: {
compress: {
unused: false // TypeError: redeclaration of const undefined if true
},
mangle: false,
toplevel: false,
keep_classnames: true,
keep_fnames: true,
ie8: true,
ecma: 5,
output: {
comments: true,
beautify: true
}
}
});
const config = {
context: basePath,
mode: "production",
entry: {
sheets: path.join(basePath, "src", "index.ts")
},
output: {
path: path.join(basePath, "dist"),
filename: "[name].js"
},
plugins: [new GasPlugin()],
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
loaders: [
{
loader: "babel-loader",
options: { presets }
}
]
},
{
test: /\.html$/,
exclude: /node_modules/,
loader: "html-loader"
}
]
},
optimization: {
minimizer: [uglify],
runtimeChunk: false,
noEmitOnErrors: true,
concatenateModules: true
}
};
module.exports = config;