vue项目中 favicon.ico不能正确显示的问题


方法一:修改index.html文件

<link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/> 

方法二:修改webpack配置文件

1、找到build下的webpack.dev.conf.js文件

new HtmlWebpackPlugin({ filename: 'index.html', template: 'index.html', inject: true, favicon: path.resolve('favicon.ico') // 增加 }), 

2、找到build下的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 ... }), 


作者:易冷zzz
链接:https://www.jianshu.com/p/980cb1caf7a8
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM