You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For any system that relies on middleware to finish its processes before continuing onto the next tick, webpack-dev-middleware presents headaches.
At https://github.com/webpack/webpack-dev-middleware/blob/master/middleware.js#L156 the callback to compiler.run is of no use other than to report an error. If this middleware were to implement Promises, or at the least chained error-first callbacks all the way to the exported middleware function (allowing folks to wrap in promises or use thunks), other components could rely on it finishing before proceeding. And that would be a major improvement.
As of now the middleware returns immediately, while the compiler may not have finished. This causes unexpected issues down the pipe. Such an issue is documented here: shellscape/koa-webpack#2
The text was updated successfully, but these errors were encountered:
I don't think implementing Promises is a good idea for now, since webpack still uses callback style methods. I'd rather wait for webpack to implement Promises.
However, I'm open to providing more hooks. Note also that after #140 it should be easier to implement middleware for other servers.
@SpaceK33z would you be open to a PR adding a catch-all compiler callback hook? Right now, there's a hook for errors that works, but not really any hooks to indicate success. Honestly, it would be easier to just have one generic callback with an error parameter as the first argument. I know this would be a breaking change though so might be tough 😕
For any system that relies on middleware to finish its processes before continuing onto the next tick, webpack-dev-middleware presents headaches.
At https://github.com/webpack/webpack-dev-middleware/blob/master/middleware.js#L156 the callback to
compiler.run
is of no use other than to report an error. If this middleware were to implement Promises, or at the least chained error-first callbacks all the way to the exported middleware function (allowing folks to wrap in promises or use thunks), other components could rely on it finishing before proceeding. And that would be a major improvement.As of now the middleware returns immediately, while the compiler may not have finished. This causes unexpected issues down the pipe. Such an issue is documented here: shellscape/koa-webpack#2
The text was updated successfully, but these errors were encountered: