The hook "failed" does not exist on a MultiCompiler
mike-marcacci opened this issue · 2 comments
Thanks for the super helpful project!
- Node Version: 9.6.1
- koa Version: 2.5.0
- koa-wepback Version: 3.0.1
- webpack Version: 4.1.1
It appears that koa-webpack does not wait for the build to finish using Webpack 4 (probably due to new async rendering stuff). When a change is made, but before it has finished compiling, a request to the server ends with a 500 and the following in the logs:
TypeError: Cannot read property 'tap' of undefined
at Promise (/Users/mike/Code/boltline/app/node_modules/koa-webpack/index.js:24:29)
at new Promise (<anonymous>)
at waitMiddleware (/Users/mike/Code/boltline/app/node_modules/koa-webpack/index.js:19:12)
at /Users/mike/Code/boltline/app/node_modules/koa-webpack/index.js:31:5
at app.use (/Users/mike/Code/boltline/app/server.development.js:31:10)
at dispatch (/Users/mike/Code/boltline/app/node_modules/koa-compose/index.js:42:32)
at /Users/mike/Code/boltline/app/node_modules/koa-compose/index.js:34:12
at Application.handleRequest (/Users/mike/Code/boltline/app/node_modules/koa/lib/application.js:150:12)
at handleRequest (/Users/mike/Code/boltline/app/node_modules/koa/lib/application.js:132:19)
at Server.proxy (/Users/mike/Code/boltline/app/server/addProxy.js:33:9)
at Server.emit (events.js:127:13)
at parserOnIncoming (_http_server.js:642:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)
Once the build finishes, everything continues as expected. This began after upgrading to webpack 4.
// webpack.config.js
module.exports = [
{
// ...any valid config
},
{
// ...any valid config
}
];
Thanks for the issue 🍺 Unfortunately you chose to ignore part of the issue template that reads:
If you proceed with this form, please fill out all fields, or your issue may be closed as "invalid."
It's generally considered poor form on Github to skip or selectively fill out an issue template. Since this is your first stop here, we won't close the issue as invalid, but please edit your issue to include the missing sections before we can move forward.
My apologies for the omissions! The issue ended up being that a MultiCompiler
doesn't have a "failed" hook. PR #88 adds a test and fix, following the similar changes made by webpack-dev-server. Let me know if there's anything else you need me to provide.