HappyPack not work in webpack 4

问题描述:

在webpack4版本使用happypack会出现以下错误:

if (resolve.length === 4) {
                ^
TypeError: Cannot read property 'length' of undefined
    at resolveLoader (...\node_modules\happypack\lib\WebpackUtils.js:138:17)
    at ...\node_modules\happypack\lib\WebpackUtils.js:126:7
    at ...\node_modules\happypack\node_modules\async\lib\async.js:713:13
    at async.forEachOf.async.eachOf (...\node_modules\happypack\node_modules\async\lib\async.js:233:13)
    at _parallel (...\node_modules\happypack\node_modules\async\lib\async.js:712:9)
    at Object.async.parallel (...\node_modules\happypack\node_modules\async\lib\async.js:726:9)
    at Object.exports.resolveLoaders (...\node_modules\happypack\lib\WebpackUtils.js:122:9)
    at resolveLoaders (...\node_modules\happypack\lib\HappyPlugin.js:137:20)
    at ...\node_modules\happypack\node_modules\async\lib\async.js:713:13
    at iterate (...\node_modules\happypack\node_modules\async\lib\async.js:262:13)
    at async.forEachOfSeries.async.eachOfSeries (...\node_modules\happypack\node_modules\async\lib\async.js:281:9)
    at _parallel (...\node_modules\happypack\node_modules\async\lib\async.js:712:9)
    at Object.async.series (...\node_modules\happypack\node_modules\async\lib\async.js:734:9)
    at HappyPlugin.start (...\node_modules\happypack\lib\HappyPlugin.js:127:9)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (...\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (...\node_modules\tapable\lib\Hook.js:35:21)
    at hooks.beforeRun.callAsync.err (...\node_modules\webpack\lib\Compiler.js:194:19)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (...\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (...\node_modules\tapable\lib\Hook.js:35:21)
    at Compiler.run (...\node_modules\webpack\lib\Compiler.js:191:24)
    at runWithDependencies (...\node_modules\webpack\lib\MultiCompiler.js:239:15)
    at asyncLib.map (...\node_modules\webpack\lib\MultiCompiler.js:175:6)
    at arrayEachIndex (...\node_modules\neo-async\async.js:2494:9)
    at Object.map (...\node_modules\neo-async\async.js:2845:9)
    at runCompilers (...\node_modules\webpack\lib\MultiCompiler.js:172:13)
    at MultiCompiler.runWithDependencies (...\node_modules\webpack\lib\MultiCompiler.js:184:3)
    at MultiCompiler.run (...\node_modules\webpack\lib\MultiCompiler.js:235:9)
    at processOptions (...\node_modules\webpack-cli\bin\webpack.js:499:20)
    at yargs.parse (...\node_modules\webpack-cli\bin\webpack.js:502:3)
    at Object.parse (...\node_modules\yargs\yargs.js:539:18)
    at ...\node_modules\webpack-cli\bin\webpack.js:212:8
    at Object.<anonymous> (...\node_modules\webpack-cli\bin\webpack.js:504:3)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
script exit code: 1npm ERR! code ELIFECYCLE

解决方案:

yarn upgrade happypack@5.0.0

    It seems to work ok.

 

参考链接:

Incompatible with webpack@4.0.0-alpha.1 (the @next version as of now)

happypack Usage

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值