Revisit hot reload browser refresh script injection
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
Our hot reload mechanism relies on the `aspnetcore-browser-refresh.js` script being injected into the webpage so the browser can automatically refresh with hot reload changes.
We currently do this with a special middleware that searches for the last closing `` tag in HTML responses and injects a `` element just before it. However, this mechanism is very fragile because it fails when the response can't be easily parsed (e.g., response compression is enabled, the closing `` tag is split between response stream writes, etc.).
We should consider an approach where we somehow reference the browser refresh script directly rather than using this script injection middleware.
## Additional considerations
Make sure we also address the following issues:
- [ ] https://github.com/dotnet/aspnetcore/issues/33068
- [ ] https://github.com/dotnet/aspnetcore/issues/39715
Contributor guide
Assessment
This issue has not been assessed yet.