vue 添加favicon.ico 添加favicon.ico

webpack构建的环境

1.找到build下的webpack.dev.conf.js文件

new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      inject: true,
      favicon: path.resolve('favicon.ico')  //新增
 })
image.png

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
      },
image.png

3.修改配置文件后需重启npm run dev
4.打包后根目录下就会有favicon.ico

你可能感兴趣的:(vue 添加favicon.ico 添加favicon.ico)