配置favicon图标主要有两个位置。
1、开发环境:
路劲:C:\Users\JensonJin\Desktop\demo_v\build\webpack.dev.conf.js
找到:如下位置添加favicon及路径即可
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true,
favicon:'static/bitbug_favicon.ico'
})
2、生产环境,即bulid后
路劲:C:\Users\JensonJin\Desktop\demo_v\build\webpack.prod.conf.js
找到:如下位置添加favicon及路径即可
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
favicon: 'static/bitbug_favicon.ico',
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),复制代码