方法一:修改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
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權並注明出處。