解决Vue项目中favicon图标无法正常显示方法

方法一:

  1.将favicon.ico文件存放到项目根路径下;

  2.配置webpack.dev.conf.js

     new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      favicon: path.resolve('favicon.ico'),
      inject: true
    })
 
 
方法二:

  1.将favicon.ico文件存放到static文件夹下;

  2.配置webpack.dev.conf.js

     new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      favicon:'static/favicon.ico',
      inject: true
    })
 
 
方法三:
  图片文件有缓存,清除缓存

猜你喜欢

转载自www.cnblogs.com/golong/p/10881600.html