vue+webpack项目 favicon.ico不显示解决方案

1、把favicon.ico放到 index.html的同一目录
在index.html 中引入图标,
2、// 在webpack.dev.conf.js 里面的 plugins配置
new HtmlWebpackPlugin({
filename: ‘index.html’,
template: ‘index.html’,
inject: true,
favicon: ‘./favicon.ico’
}),
//在 webpack.prod.conf.js 里面 plugins 配置
new HtmlWebpackPlugin({
filename: config.build.index,
template: ‘index.html’,
inject: true,
favicon: ‘./favicon.ico’,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
},
chunksSortMode: ‘dependency’
}),
3、启动: npm run dev

你可能感兴趣的:(vue,vue.js,webpack,javascript)