把需要设置的icon放到static文件夹中
然后在index.html中引入
<link rel="icon" href="./static/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" type="image/x-icon" href="./static/favicon.ico" />
然后在webpack.dev.conf.js文件中添加一下代码
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true,
favicon: 'static/favicon.ico' // 以上3行都是自带的
})
这样就能在网页中显示了