webpack-hot-middleware icon indicating copy to clipboard operation
webpack-hot-middleware copied to clipboard

Help with errored bundles

Open glenjamin opened this issue 9 years ago • 1 comments

After a chat with @gaearon today, we came up with a nicer way to handle invalid bundles.

When using the NoErrors plugin with hot middleware, we don't reload on broken builds - but a fresh request will serve up a stale bundle.

We can pull in dev-middleware to happen inside this middleware, and then conditionally send a different bundle when in an error state.

This will also simplify things slightly for consumers - they'll only need to include one middleware.

TBC: what dependency should be added to package.json? I think peerDependency on webpack-dev-middleware makes the most sense

glenjamin avatar Feb 29 '16 05:02 glenjamin

Some wip at https://github.com/glenjamin/webpack-hot-middleware/tree/serve-valid-bundles

The basic idea is there, but I need a good way of identifying whether the file we're about to serve is a bundle - so we can tell when to replace it.

glenjamin avatar Feb 29 '16 07:02 glenjamin