Skip to content

Potential Overwriting of setupMiddlewares in devServer #108

@nanianlisao

Description

@nanianlisao

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions