-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfavicons.config.js
65 lines (61 loc) · 1.85 KB
/
favicons.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
60
61
62
63
64
65
// favicons.config.js
// returns a webpack config object for building app icons & the meta html tags
// webpack plugins
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// package.json settings
const pkg = require('../package.json');
// return a webpack config
module.exports = (type = 'modern', settings) => {
// common config
const common = () => ({
plugins: [
new HtmlWebpackPlugin({
inject: false,
excludeChunks: ['app'],
filename: 'webapp.html',
templateContent: ({htmlWebpackPlugin}) => `
${htmlWebpackPlugin.tags.headTags}
`,
}),
new FaviconsWebpackPlugin({
logo: settings.favicons.logo,
prefix: settings.favicons.prefix,
cache: false,
inject: true,
favicons: {
appName: pkg.name,
appDescription: pkg.description,
developerName: pkg.author.name,
developerURL: pkg.author.url,
path: settings.paths.dist,
}
}),
],
});
// 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];
}