-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack-config.js
59 lines (55 loc) · 1.08 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
const path = require('path');
const webpack = require('webpack');
const nodeModules = require('webpack-node-externals');
const TerserPlugin = require('terser-webpack-plugin');
const NODE_ENV = process.env.NODE_ENV || 'development';
let cfg = {
target: 'web',
mode: NODE_ENV,
entry: {
main: ['./src/main.ts'],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
publicPath: '/'
},
devtool: 'source-map',
stats: {
modules: false
},
optimization: {
splitChunks: false,
runtimeChunk: false,
minimize: true,
minimizer: [
new TerserPlugin({ terserOptions: {
keep_classnames: true,
keep_fnames: true
}})
]
},
performance: {
hints: "warning"
},
resolve: {
extensions: ['.ts', '.js', '.json']
},
module: {
rules: [
{
test: /\.ts/,
use: [
{ loader: 'ts-loader' }
]
}
]
},
plugins: [
new webpack.EnvironmentPlugin({NODE_ENV})
]
};
if (process.env.ENABLE_WATCH === 'true') {
cfg.watch = true;
}
module.exports = cfg;