webpack / webpack-dev-server

Serves a webpack app. Updates the browser on changes. Documentation https://webpack.js.org/configuration/dev-server/.
MIT License
7.76k stars 1.43k forks source link

Refactor webpack-dev-server middleware application logic #5149

Open Swapnilden opened 3 months ago

Swapnilden commented 3 months ago

This commit refactors the middleware application logic in the webpack-dev-server codebase to ensure that middleware is applied only once, regardless of how many times it's called.

Previously, certain middleware, such as static serving middleware, was being applied multiple times to support features like historyApiFallback. This refactor eliminates duplicate middleware application by introducing a mechanism to track applied middleware and applying each middleware only once.

Changes:

This update aims to improve code efficiency and prevent unintended behavior or performance issues caused by duplicate middleware application.

Fixes: #2716

For Bugs and Features; did you add new tests?

Motivation / Use-Case

Breaking Changes

Additional Info