-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbanner.config.js
58 lines (54 loc) · 1.58 KB
/
banner.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
// banner.config.js
// returns a webpack config object for generating file banners
// webpack plugins
const webpack = require('webpack');
// package.json settings
const pkg = require('../package.json');
// return a webpack config
module.exports = (type = 'modern', settings) => {
const timestamp = new Date();
// common config
const common = () => ({
plugins: [
new webpack.BannerPlugin({
banner: [
'/*!',
' * @project ' + settings.name,
' * @name ' + '[base]',
' * @author ' + pkg.author.name,
' * @build ' + timestamp.toString(),
' * @copyright Copyright (c) ' + timestamp.getFullYear() + ' ' + settings.copyright,
' *',
' */',
''
].join('\n'),
raw: true
}),
],
});
// 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];
}