codymikol / karma-webpack

Karma webpack Middleware
MIT License
830 stars 221 forks source link

TypeError: The 'compilation' argument must be an instance of Compilation #509

Closed TranquilMarmot closed 3 years ago

TranquilMarmot commented 3 years ago

When running karma, the following error is printed out:

START:
Webpack bundling...
14 05 2021 14:20:43.679:ERROR [karma-server]: TypeError: The 'compilation' argument must be an instance of Compilation
    at Function.getCompilationHooks (/path/to/project/node_modules/.pnpm/webpack@5.37.0_webpack-cli@4.6.0/node_modules/webpack/lib/NormalModule.js:195:10)
    at /path/to/project/node_modules/.pnpm/webpack-manifest-plugin@3.1.1_webpack@5.37.0/node_modules/webpack-manifest-plugin/lib/index.js:56:24
    at _next24 (eval at create (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:50:1)
    at _next2 (eval at create (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:97:1)
    at Hook.eval (eval at create (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:105:1)
    at Hook.CALL_DELEGATE [as _call] (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/path/to/project/node_modules/.pnpm/webpack@5.37.0/node_modules/webpack/lib/Compiler.js:1031:26)
    at /path/to/project/node_modules/.pnpm/webpack@5.37.0/node_modules/webpack/lib/Compiler.js:1073:29
    at Hook.eval [as callAsync] (eval at create (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.compile (/path/to/project/node_modules/.pnpm/webpack@5.37.0/node_modules/webpack/lib/Compiler.js:1068:28)
    at /path/to/project/node_modules/.pnpm/webpack@5.37.0/node_modules/webpack/lib/Compiler.js:496:12
    at Compiler.readRecords (/path/to/project/node_modules/.pnpm/webpack@5.37.0/node_modules/webpack/lib/Compiler.js:908:11)
    at /path/to/project/node_modules/.pnpm/webpack@5.37.0/node_modules/webpack/lib/Compiler.js:493:11
    at Hook.eval [as callAsync] (eval at create (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/path/to/project/node_modules/.pnpm/tapable@2.2.0/node_modules/tapable/lib/Hook.js:18:14)
rake aborted!
codymikol commented 3 years ago

What version of karma are you using?

TranquilMarmot commented 3 years ago

We're on Karma 4.1.0... eventually I got this to work by removing random bits of Webpack config but I could never track down exactly which config value it was complaining about. Our webpack config is very complex so I'm not surprised there was something weird in it šŸ˜ƒ

codymikol commented 3 years ago

Glad to hear it is working : )