Generated index.html is the same for different requests
Describe the bug
I write MRE - https://github.com/DudaGod/vite-gen-index.html-issue. In this repo I use post hook configureServer in which I call transformIndexHtml on each request. I expect that for different queries (they differ in the value of the query parameter) will be generated different index.html. But when opening two pages with different query parameters at the same time I get the same generated script that outputs the log from the first request.
- http://localhost:4444/@id/x00/?uuid=12345?html-proxy&index=0.js
- http://localhost:4444/@id/x00/?uuid=67890?html-proxy&index=0.js
Reproduction
https://github.com/DudaGod/vite-gen-index.html-issue
Steps to reproduce
- Install packages using npm install
- Run script node ./vite-run.js
- As a result, 2 pages with http://localhost:4444/?uuid=12345 and http://localhost:4444/?uuid=67890 urls will open. And both of them will have 12345 in the log (it is almost always reproduced with rare exceptions).
System Info
System:
OS: macOS 13.6
CPU: (10) arm64 Apple M1 Pro
Memory: 529.50 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v18.12.1/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
pnpm: 6.34.0 - ~/.nvm/versions/node/v18.12.1/bin/pnpm
Browsers:
Chrome: 124.0.6367.61
Safari: 16.6
npmPackages:
vite: ^5.2.9 => 5.2.9
Used Package Manager
npm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Looks like problem is here. Inside cleanUrl all query params are replaced to empty string. As a result all my requests cached to the same path - /.
Looks like this is expected behaviour and in my case I should modify query parameter to path, like this:
http://localhost:4444/?uuid=12345 -> http://localhost:4444/12345