Skip to content
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

Potential Overwriting of setupMiddlewares in devServer #108

Open
nanianlisao opened this issue Nov 30, 2023 · 0 comments
Open

Potential Overwriting of setupMiddlewares in devServer #108

nanianlisao opened this issue Nov 30, 2023 · 0 comments

Comments

@nanianlisao
Copy link

Hello,

I am using the error-overlay-webpack-plugin in my project and I noticed that the devServer.setupMiddlewares is directly reassigned in the plugin's code. This could potentially overwrite any existing middlewares that have been set up.

Here is the code snippet:

compiler.hooks.afterResolvers.tap(className, ({ options }) => {
if (devServerEnabled) {
const originalOnBeforeSetupMiddleware =
options.devServer.onBeforeSetupMiddleware
options.devServer.setupMiddlewares = (middlewares, devServer) => {
if (originalOnBeforeSetupMiddleware) {
originalOnBeforeSetupMiddleware(devServer)
}
middlewares.unshift(errorOverlayMiddleware());
return middlewares;
}
}
})

Could you please confirm if this is the intended behavior? If so, it might be helpful to add a note in the documentation to inform users about this.

Thank you for your time and assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant