-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
52 lines (47 loc) · 1.41 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin'); // Generate index.html with built JS
const TerserPlugin = require("terser-webpack-plugin"); // Mangle JS for Production.
module.exports = (env, argv) => {
const isProductionBuild = env.WEBPACK_SERVE ? false : true
// const isProductionBuild = true
console.info("Running production build? ", isProductionBuild)
return {
entry: './main.js',
mode: isProductionBuild ? 'production' : 'development' ,
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'entry-point.js',
publicPath: '', // Avoid a leading / being added to paths.
},
devServer: {
static: {
directory: path.join(__dirname, 'static'),
},
compress: true,
port: 9000,
},
resolve: {
alias: {
"@game": path.resolve(__dirname, "game"),
"@core": path.resolve(__dirname, "core-js/src")
},
},
plugins: [new HtmlWebpackPlugin()],
optimization: {
minimize: isProductionBuild,
minimizer: [
new TerserPlugin({
terserOptions: {
mangle: {
keep_fnames: false, // Disable keeping original function names
keep_classnames: false, // Disable keeping original class names
properties: {
keep_quoted: true
},
}
}
})
]
},
}
}