vue设置favicon.ico图标

favicon.ico存放位置

将avicon.ico在根目录下(与index.html放在同一级)

方式一:

<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />

方式二:

/build/webpack.dev.conf.js

 new HtmlWebpackPlugin({
     
      filename: 'index.html',
      template: 'index.html',
      inject: true,
      favicon: 'favicon.ico'  //添加网页标题图标
    }),

webpack.prod.conf.js

new HtmlWebpackPlugin({
     
      filename: config.build.index,
      template: 'index.html',
      inject: true,
      minify: {
     
        removeComments: true,
        collapseWhitespace: true,
        removeAttributeQuotes: true
        // more options:
        // https://github.com/kangax/html-minifier#options-quick-reference
      },
      // necessary to consistently work with multiple chunks via CommonsChunkPlugin
      chunksSortMode: 'dependency',
      favicon: 'favicon.ico'//新增
    }),

你可能感兴趣的:(Vue,vue)