关于vue.js:HappyPack报错记录HappyPack-unable-to-locate-the-plugin-list

happyPack报错:HappyPack: unable to locate the plugin list! This most likely indicates an internal error.

原代码:

configureWebpack: config => {
  //happypack - js 局部
  config.module.rules.push({
    test: /\.js$/,
    loader: 'happypack/loader?id=happyBabel',
  })
  config.plugins.push(new HappyPack({
    id: 'happyBabel',
    loaders: [{
      loader: 'babel-loader?cacheDirectory=true',
    }],
    threadPool: happyThreadPool,
    //容许 HappyPack 输入日志
    verbose: true,
  })
}

尝试后发现应该是js的rule局部有问题,去掉下面写在configureWebpack中的rule局部,批改为在chainWebpack中革除js的rule规定后,再进行happypack配置。

批改后代码:

//happyPack - js 局部
chainWebpack: config => {
  const jsRule = config.module.rule('js');
  jsRule.uses.clear();
  jsRule.use('happypack/loader?id=happyBabel')
        .loader('happypack/loader?id=happyBabel')
        .end();
}
configureWebpack: config => {
  //happypack - js 局部
  config.plugins.push(new HappyPack({
    id: 'happyBabel',
    loaders: [{
      loader: 'babel-loader?cacheDirectory=true',
    }],
    threadPool: happyThreadPool,
    //容许 HappyPack 输入日志
    verbose: true,
  })
}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理