无论怎么配置路径小图标都不显示的问题
百度了很久都是在说路径的问题以及图标大小的问题
最后在webpack.dev.conf.js的配置文件
增加
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true,
+ favicon: path.resolve('favicon.ico')
}),
写完重新跑一下项目 npm run dev
页面就出现了
打包的时候在webpack.prod.conf.js的配置文件
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
+ favicon: path.resolve('favicon.ico'),
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
},
chunksSortMode: 'dependency'
}),
这里用path去处理路径 打包之后在服务器部署的时候上传favicon.ico图标到根目录
就可以出现了