codymikol / karma-webpack

Karma webpack Middleware
MIT License
830 stars 222 forks source link

TypeError: Cannot read property 'thisCompilation' of undefined #365

Closed jonathanlinat closed 5 years ago

jonathanlinat commented 6 years ago

Code

03 10 2018 17:59:24.502:ERROR [preprocess]: Can not load "webpack"!
  TypeError: Cannot read property 'thisCompilation' of undefined
    at Plugin.<anonymous> (C:\Project\node_modules\karma-webpack\lib\karma-webpack.js:135:20)
    at Array.forEach (<anonymous>:null:null)
    at Plugin (C:\Project\node_modules\karma-webpack\lib\karma-webpack.js:134:16)
    at invoke (C:\Project\node_modules\di\lib\injector.js:75:15)
    at Array.instantiate (C:\Project\node_modules\di\lib\injector.js:59:20)
    at get (C:\Project\node_modules\di\lib\injector.js:48:43)
    at C:\Project\node_modules\di\lib\injector.js:71:14
    at Array.map (<anonymous>:null:null)
    at Array.invoke (C:\Project\node_modules\di\lib\injector.js:70:31)
    at Injector.get (C:\Project\node_modules\di\lib\injector.js:48:43)
    at instantiatePreprocessor (C:\Project\node_modules\karma\lib\preprocessor.js:50:20)
    at Array.forEach (<anonymous>:null:null)
    at createPreprocessor (C:\Project\node_modules\karma\lib\preprocessor.js:68:20)
    at Array.invoke (C:\Project\node_modules\di\lib\injector.js:75:15)
    at get (C:\Project\node_modules\di\lib\injector.js:48:43)
    at C:\Project\node_modules\di\lib\injector.js:71:14
    at Array.map (<anonymous>:null:null)
    at Injector.invoke (C:\Project\node_modules\di\lib\injector.js:70:31)
    at Promise.all.then.then (C:\Project\node_modules\karma\lib\server.js:123:24)
    at tryCatcher (C:\Project\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Project\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\Project\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (C:\Project\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\Project\node_modules\bluebird\js\release\promise.js:694:18)
    at _drainQueueStep (C:\Project\node_modules\bluebird\js\release\async.js:138:12)
    at _drainQueue (C:\Project\node_modules\bluebird\js\release\async.js:131:9)
    at Async._drainQueues (C:\Project\node_modules\bluebird\js\release\async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (C:\Project\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:694:18)
    at tryOnImmediate (timers.js:665:5)
    at processImmediate (timers.js:647:5)
applyPlugins.forEach(function(compiler) {
    compiler.hooks.thisCompilation.tap(this.plugin, (compilation, params) => {
        compilation.dependencyFactories.set(
            SingleEntryDependency,
            params.normalModuleFactory
        );
    });
    compiler.hooks.make.tapAsync(this.plugin, this.make.bind(this));
}, this);

How Do We Reproduce?

Just use the latest commited version of karma-webpack.

alexander-akait commented 6 years ago

@jonathanlinat please update you webpack version, latest version (4.0.0-rc.2) require webpack@4 https://github.com/webpack-contrib/karma-webpack/blob/master/package.json#L41