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,
})
}