/
webpack.config.js
45 lines (44 loc) · 1.04 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
const { DefinePlugin } = require('webpack');
module.exports = (env) => {
if (env.isProd) {
return {
entry: './a.js',
output: {
filename: 'prod.js',
},
};
}
if (env.foo === `''`) {
return {
entry: './a.js',
output: {
filename: 'empty-string.js',
},
};
}
if (env.foo === `bar=''`) {
return {
entry: './a.js',
output: {
filename: 'new-empty-string.js',
},
};
}
if (env['foo=']) {
return {
entry: './a.js',
output: {
filename: 'equal-at-the-end.js',
},
};
}
return {
entry: './a.js',
mode: 'development',
stats: env.verboseStats ? 'verbose' : 'normal',
plugins: [new DefinePlugin({ envMessage: env.envMessage ? JSON.stringify('env message present') : false })],
output: {
filename: 'dev.js',
},
};
};