{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack-dev-middleware/issues/156","repository_url":"https://api.github.com/repos/webpack/webpack-dev-middleware","labels_url":"https://api.github.com/repos/webpack/webpack-dev-middleware/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack-dev-middleware/issues/156/comments","events_url":"https://api.github.com/repos/webpack/webpack-dev-middleware/issues/156/events","html_url":"https://github.com/webpack/webpack-dev-middleware/issues/156","id":194732826,"number":156,"title":"Errors in async tasks cause webpack to hang","user":{"login":"hansl","id":681969,"avatar_url":"https://avatars.githubusercontent.com/u/681969?v=3","gravatar_id":"","url":"https://api.github.com/users/hansl","html_url":"https://github.com/hansl","followers_url":"https://api.github.com/users/hansl/followers","following_url":"https://api.github.com/users/hansl/following{/other_user}","gists_url":"https://api.github.com/users/hansl/gists{/gist_id}","starred_url":"https://api.github.com/users/hansl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansl/subscriptions","organizations_url":"https://api.github.com/users/hansl/orgs","repos_url":"https://api.github.com/users/hansl/repos","events_url":"https://api.github.com/users/hansl/events{/privacy}","received_events_url":"https://api.github.com/users/hansl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-10T01:03:19Z","updated_at":"2016-12-10T08:35:30Z","closed_at":null,"body":"I want to report a **bug**.\r\n\r\n\r\n## What is the current behavior?\r\nWebpack hangs indefinitely when using `webpack-dev-middleware` (directly or indirectly through `webpack-dev-server`) and there's an error in an async step.\r\n\r\n## Steps to reproduce.\r\nMake a plugin like this:\r\n\r\n```typescript\r\nclass MyErrorPlugin {\r\n  apply(compiler) {\r\n    compiler.plugin('make', (compilation, cb) => {\r\n      setTimeout(() => cb(new Error('Heho!')), 1);\r\n    });\r\n  }\r\n}\r\n```\r\n\r\nRun a webpack configuration with `webpack-dev-middleware` and this plugin, and the generation will hang forever.\r\n\r\nNote 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.\r\n\r\nThe reason is the callback used when running webpack (see [here](https://github.com/webpack/webpack-dev-middleware/blob/6b49341db9c1323a1304ff99092036a72d2449a8/lib/Shared.js#L164) and [here (watch)](https://github.com/webpack/webpack-dev-middleware/blob/6b49341db9c1323a1304ff99092036a72d2449a8/lib/Shared.js#L153)) 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 the `make` step of the compiler to finish, which won't happen because the `throw` killed the task.\r\n\r\nNot sure what the proper solution is.\r\n\r\n# What is the expected behavior?\r\nShow error on console, say the bundle is INVALID or something, watch for file changes, rebuild when file changes.\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/webpack-dev-middleware/issues/comments/266190067","html_url":"https://github.com/webpack/webpack-dev-middleware/issues/156#issuecomment-266190067","issue_url":"https://api.github.com/repos/webpack/webpack-dev-middleware/issues/156","id":266190067,"user":{"login":"SpaceK33z","id":533616,"avatar_url":"https://avatars.githubusercontent.com/u/533616?v=3","gravatar_id":"","url":"https://api.github.com/users/SpaceK33z","html_url":"https://github.com/SpaceK33z","followers_url":"https://api.github.com/users/SpaceK33z/followers","following_url":"https://api.github.com/users/SpaceK33z/following{/other_user}","gists_url":"https://api.github.com/users/SpaceK33z/gists{/gist_id}","starred_url":"https://api.github.com/users/SpaceK33z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpaceK33z/subscriptions","organizations_url":"https://api.github.com/users/SpaceK33z/orgs","repos_url":"https://api.github.com/users/SpaceK33z/repos","events_url":"https://api.github.com/users/SpaceK33z/events{/privacy}","received_events_url":"https://api.github.com/users/SpaceK33z/received_events","type":"User","site_admin":false},"created_at":"2016-12-10T08:35:30Z","updated_at":"2016-12-10T08:35:30Z","body":"Thanks for your clear bug report. I *think* the best solution would be to simply log the error, using `options.warn` instead of `throw`.\r\n\r\nWould you be interested in making a PR for this? I could also fix it, but it will take a bit longer before I have time."}}
{"actor":{"display_login":"SpaceK33z"}}