-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Revisit hot reload browser refresh script injection #45213
Copy link
Copy link
Open
Labels
Pillar: Dev ExperiencePriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-hot-reloadThis issue is related to the Hot Reload feaatureThis issue is related to the Hot Reload feaaturetriaged
Milestone
Metadata
Metadata
Assignees
Labels
Pillar: Dev ExperiencePriority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-hot-reloadThis issue is related to the Hot Reload feaatureThis issue is related to the Hot Reload feaaturetriaged
Type
Fields
Give feedbackNo fields configured for Feature.
Our hot reload mechanism relies on the
aspnetcore-browser-refresh.jsscript 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:
_framework/aspnetcore-browser-refresh.jsdue to CSP #33068