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

Refactor webpack-dev-server middleware application logic #5149

Closed
wants to merge 6 commits into from

Commits on Apr 11, 2024

  1. Refactor webpack-dev-server middleware application logic

    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:
    - Introduced `appliedMiddleware` array to track applied middleware.
    - Created `applyMiddlewareOnce` function to apply middleware only if it hasn't been applied before.
    - Updated webpack-dev-server codebase to utilize `applyMiddlewareOnce` for applying middleware associated with various features.
    
    This update aims to improve code efficiency and prevent unintended behavior or performance issues caused by duplicate middleware application.
    
    Fixes: webpack#2716
    Swapnilden authored Apr 11, 2024
    Configuration menu
    Copy the full SHA
    a39fb68 View commit details
    Browse the repository at this point in the history
  2. Update Server.js

    In this updated version, I have included test cases to ensure that the applyMiddlewareOnce function behaves as expected. Additionally, I have removed references to contentBase, as requested.
    Swapnilden authored Apr 11, 2024
    Configuration menu
    Copy the full SHA
    58bc6bd View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2024

  1. Update Server.js

    Swapnilden authored Apr 15, 2024
    Configuration menu
    Copy the full SHA
    99e92e4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1f5b86f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2efc25a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    645833d View commit details
    Browse the repository at this point in the history