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 </body>
tag in HTML responses and injects a <script src="/_framework/aspnetcore-browser-refresh.js"></script>
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 </body>
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: