I am trying to upgrade to webpack 4 from 2. Getting the following of webpack-middleware error while running the server.
Versions:
Webpack: 4.34.0
webpack-middleware: 1.5.1
node: 10.0.0
TypeError: callback is not a function
at invalidAsyncPlugin (/Users/nilofer/workplace/node_modules/webpack-middleware/middleware.js:104:3)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/nilofer/workplace/node_modules/tapable/lib/HookCodeFactory.js:33:10), :18:1)
at AsyncSeriesHook.lazyCompileHook (/Users/nilofer/workplace/node_modules/tapable/lib/Hook.js:154:20)
at Watching._go (/Users/nilofer/workplace/node_modules/webpack/lib/Watching.js:40:32)
at Watching.compiler.readRecords.err (/Users/nilofer/workplace/node_modules/webpack/lib/Watching.js:32:9)
at Compiler.readRecords (/Users/nilofer/workplace/node_modules/webpack/lib/Compiler.js:479:11)
at new Watching (/Users/nilofer/workplace/node_modules/webpack/lib/Watching.js:29:17)
at Compiler.watch (/Users/nilofer/workplace/node_modules/webpack/lib/Compiler.js:207:10)
at runWithDependencies (/Users/nilofer/workplace/node_modules/webpack/lib/MultiCompiler.js:203:30)
at asyncLib.map (/Users/nilofer/workplace/node_modules/webpack/lib/MultiCompiler.js:178:6)
at arrayEachIndex (/Users/nilofer/workplace/node_modules/neo-async/async.js:2548:9)
at Object.map (/Users/nilofer/workplace/node_modules/neo-async/async.js:2900:9)
at runCompilers (/Users/nilofer/workplace/node_modules/webpack/lib/MultiCompiler.js:175:13)
at MultiCompiler.runWithDependencies (/Users/nilofer/workplace/node_modules/webpack/lib/MultiCompiler.js:187:3)
at MultiCompiler.watch (/Users/nilofer/workplace/node_modules/webpack/lib/MultiCompiler.js:198:9)
at module.exports (/Users/nilofer/workplace/node_modules/webpack-middleware/middleware.js:129:27)
at /Users/nilofer/workplace/frontend-utilities/tools/start.js:92:26
at new Promise (/Users/nilofer/workplace/node_modules/babel-cli/node_modules/core-js/modules/es6.promise.js:177:7)
at /Users/nilofer/workplace/tools/start.js:23:9
at Generator.next ()
at step (/Users/nilofer/workplace/tools/start.js:175:191)
at /Users/nilofer/workplace/tools/start.js:175:361
Commenting it, the code works. But unable to resolve this.
i'm getting the same error while integrating webpack 4
Looks like this module can't be be used with Webpack 4.
Navigating to node-modules > webpack-middleware > package.json
We will see ,
"peerDependencies": { "webpack": ">=1.0.0 <3" },
This should be the reason for our issue.
Though this says that this module will not run for webpack version >= 3 but it is working fine for me @v3. I have no idea why.