其他分享
首页 > 其他分享> > chainWebpack 和 htmlWebpackPlugin搭配使用

chainWebpack 和 htmlWebpackPlugin搭配使用

作者:互联网

const HtmlWebpackPlugin = require('html-webpack-plugin');


...

chainWebpack: config => {
    config
        .plugin('html')
            .use(HtmlWebpackPlugin)
            .tap(options  => {
                options.BASE_URL = 'sss'
                options.template = __dirname + '/public/index.html'
                options.title = 'sssssssssssss'
            return options
            })        
    }

注意看vue-cli3引用的html-webpack-plugin默认配置

 constructor (options) {
    // Default options
    this.options = _.extend({
      template: path.join(__dirname, 'default_index.ejs'),
      templateParameters: templateParametersGenerator,
      filename: 'index.html',
      hash: false,
      inject: true,
      compile: true,
      favicon: false,
      minify: false,
      cache: true,
      showErrors: true,
      chunks: 'all',
      excludeChunks: [],
      chunksSortMode: 'auto',
      meta: {},
      title: 'Webpack App',
      xhtml: false
    }, options);
  }

 

标签:index,false,plugin,搭配,html,chainWebpack,htmlWebpackPlugin,true,options
来源: https://www.cnblogs.com/1rookie/p/10795928.html