美文网首页
vue修改favicon.ico

vue修改favicon.ico

作者: 凌康ACG | 来源:发表于2019-12-03 22:33 被阅读0次

一、

favicon.ico图片放在src/assets/favicon.ico

二、

build/webpack.dev.conf.js

    // https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      inject: true,
      //图标
      favicon: path.resolve('src/assets/favicon.ico')
    }),

build/webpack.prod.conf.js

    // generate dist index.html with correct asset hash for caching.
    // you can customize output by editing /index.html
    // see https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      filename: config.build.index,
      template: 'index.html',
      inject: true,
      //图标
      favicon: path.resolve('src/assets/favicon.ico'),
      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'
    }),

相关文章

网友评论

      本文标题:vue修改favicon.ico

      本文链接:https://www.haomeiwen.com/subject/ahnhgctx.html