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

TypeError: Cannot read property 'length' of undefined
at resolveLoader (/__CENSORED__/node_modules/happypack/lib/WebpackUtils.js:138:17)
at /__CENSORED__/node_modules/happypack/lib/WebpackUtils.js:126:7
at /__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:713:13
at async.forEachOf.async.eachOf (/__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:233:13)
at _parallel (/__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:712:9)
at Object.async.parallel (/__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:726:9)
at Object.exports.resolveLoaders (/__CENSORED__/node_modules/happypack/lib/WebpackUtils.js:122:9)
at resolveLoaders (/__CENSORED__/node_modules/happypack/lib/HappyPlugin.js:137:20)
at /__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:713:13
at iterate (/__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:262:13)
at async.forEachOfSeries.async.eachOfSeries (/__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:281:9)
at _parallel (/__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:712:9)
at Object.async.series (/__CENSORED__/node_modules/happypack/node_modules/async/lib/async.js:734:9)
at HappyPlugin.start (/__CENSORED__/node_modules/happypack/lib/HappyPlugin.js:127:9)
at /__CENSORED__/node_modules/happypack/lib/HappyPlugin.js:100:12
at AsyncSeriesHook.eval [as callAsync] (eval at create (/__CENSORED__/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:7:1)
at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/__CENSORED__/node_modules/tapable/lib/Hook.js:35:21)
at Watching._go (/__CENSORED__/node_modules/webpack/lib/Compiler.js:54:32)
at Watching.compiler.readRecords.err (/__CENSORED__/node_modules/webpack/lib/Compiler.js:46:9)
at Compiler.readRecords (/__CENSORED__/node_modules/webpack/lib/Compiler.js:500:11)
at new Watching (/__CENSORED__/node_modules/webpack/lib/Compiler.js:43:17)
at Compiler.watch (/__CENSORED__/node_modules/webpack/lib/Compiler.js:334:20)

function resolveLoader(context, loader, callback) {
var resolve = compiler.resolvers.loader.resolve;
var resolveContext = compiler.resolvers.loader;
// webpack2 has changed the signature for the resolve method where it accepts
// a fourth argument (context), so we need to sniff and support both versions
//
// fixes #23
if (resolve.length === 4) {

Refs webpack/webpack#6132 (comment)

30 Answers

✔️Accepted Answer

As webpack 4 comes out of alpha, I'm getting the same error as @damianobarbati.

Other Answers:

Try out happypack@next or happypack@5.0.0-beta.1 and confirm if it's working in your setup. I just tested it on a project that's recently been upgraded to webpack 4 and seems to work OK.

Thanks to @marcokam for the contribution.

I'm getting a slightly different error:

/Users/damz/Desktop/yarsk/node_modules/happypack/lib/WebpackUtils.js:138
    if (resolve.length === 4) {
                ^

TypeError: Cannot read property 'length' of undefined
    at resolveLoader (/Users/damz/Desktop/yarsk/node_modules/happypack/lib/WebpackUtils.js:138:17)

But I guess these are general compatibility errors.

More Issues: