小图标素材地址:https://www.iconfont.cn/
添加的方法:
//webpack.prod.conf.js中添加如下代码
const path = require('path') ;
.....
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
favicon: path.resolve('./favicon.ico'),
inject: true,
}),
//在webpack.prod.dev.js中添加如下代码:
const path = require('path');
.....
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
favicon: path.resolve('./favicon.ico'),
inject: true,
}),
//在index.html中的title下面添加下面代码
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico" rel="external nofollow" />