方法一:修改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
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

相关文章:

  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-08-10
  • 2022-01-16
  • 2021-08-26
  • 2021-08-25
猜你喜欢
  • 2021-10-21
  • 2022-01-11
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案