-
-
Notifications
You must be signed in to change notification settings - Fork 380
Errors in async tasks cause webpack to hang #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for your clear bug report. I think the best solution would be to simply log the error, using |
Could you check if #157 fixes it for you? |
Seems like #157 fixes the middleware part, but webpack itself is hanging. Running this config: class CustomErrorPlugin {
apply(compiler) {
compiler.plugin('make', function(compilation, callback) {
Promise.resolve()
.then(() => console.log('0'))
.then(() => callback(new Error('hello')));
});
}
}
module.exports = {
resolve: {
extensions: ['.ts', '.js']
},
entry: './app/main.ts',
output: {
path: './dist',
filename: 'app.main.js'
},
plugins: [
new CustomErrorPlugin()
],
module: {
loaders: [
{ test: /\.css$/, loader: 'raw-loader' },
{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.ts$/, loader: 'awesome-typescript-loader' }
]
},
devServer: {
historyApiFallback: true
}
};
|
(note there is no middleware). |
I'll file a bug with Webpack itself. |
I want to report a bug.
What is the current behavior?
Webpack hangs indefinitely when using
webpack-dev-middleware
(directly or indirectly throughwebpack-dev-server
) and there's an error in an async step.Steps to reproduce.
Make a plugin like this:
Run a webpack configuration with
webpack-dev-middleware
and this plugin, and the generation will hang forever.Note that this occurs in the Webpack plugin for Angular 2, when an application cannot be statically analyzable, since we perform that analysis . Also, if this error is not reported in the async task everything works as the expected behaviour.
The reason is the callback used when running webpack (see here and here (watch)) which simply
throw
instead of reporting the error and stopping the build. Because the build is not stopped by Webpack itself, webpack is waiting for themake
step of the compiler to finish, which won't happen because thethrow
killed the task.Not sure what the proper solution is.
What is the expected behavior?
Show error on console, say the bundle is INVALID or something, watch for file changes, rebuild when file changes.
The text was updated successfully, but these errors were encountered: