-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclean.config.js
44 lines (41 loc) · 1.08 KB
/
clean.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
// clean.config.js
// returns a webpack config object for cleaning build assets
// webpack plugins
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
// return a webpack config
module.exports = (type = 'modern', settings) => {
// common config
const common = () => ({
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: settings.clean,
verbose: false,
}),
],
});
// configs
const configs = {
// development configs
development: {
// legacy development config
legacy: {
},
// modern development config
modern: {
...common(),
},
},
// production configs
production: {
// legacy production config
legacy: {
...common(),
},
// modern production config
modern: {
...common(),
},
}
};
return configs[process.env.NODE_ENV][type];
}