webpack / webpack/webpack-dev-server
behavior of static and historyApiFallback
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.8k
- Forks
- 1.5k
- Avg merge
- 5h 32m
- Merged PRs (30d)
- 6
Description
Expected Behavior
Static serving middleware for the dev server should only need to be applied to the express server once via this.app.use(...)
Actual Behavior
static middleware is applied to the express server multiple times in order to make historyApiFallback work as expected. This is explained here: https://github.com/webpack/webpack-dev-server/pull/2670#discussion_r464946541
A similar thing seems to have been added for the middleware feature as seen here, as it is added multiple times:
Solution
We need to find a way to either apply all of this middleware once without having any breaking changes, or have intentional slight breaking changes while only applying the middleware once. We should also look into if applying the same middleware many times causes performance losses, or if it is an acceptable thing to do.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the linked discussion on pull request 2670 and inspect lib/Server.js around lines 548–559, where the middleware feature is added. Then trace how static serving and historyApiFallback are configured and consider the compatibility and performance tradeoffs described in the issue. Done means identifying a way to apply middleware once, or documenting an intentional breaking change and its implications.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, javascript, webpack
- Domain
- backend, devtools
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100