dotnet / dotnet/aspnetcore

[Blazor] Failed to load JS initializer in WasmMinimal app in tests

Open
#63,204 1 comment 0 reactions 1 assignee Claimed by @maraf View on GitHub
area-blazor feature-blazor-wasm
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

```
[Severe] http://127.0.0.1:37189/subdir/WasmMinimal/_content/Microsoft.DotNet.HotReload.WebAssembly.Browser/Microsoft.DotNet.HotReload.WebAssembly.Browser.qp2w4j0l7o.lib.module.js - Failed to load resource: the server responded with a status of 404 (Not Found)
```

The URL Is correct
- App is hosted on `/subdir/`
- WasmMinimal client is hosted on `/WasmMinimal/` [RazorComponentEndpointsStartup.cs#L167](https://github.com/dotnet/aspnetcore/blob/main/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs#L167)

Other framework assets loaded from a similar URLs
- `http://127.0.0.1:37189/subdir/WasmMinimal/_framework/dotnet.js`

Based on it, the URL for HotReload is generally correct
- `http://127.0.0.1:37189/subdir/WasmMinimal/_content/Microsoft.DotNet.HotReload.WebAssembly.Browser/Microsoft.DotNet.HotReload.WebAssembly.Browser.qp2w4j0l7o.lib.module.js`

HotReload JS initializer relies on StaticWebAssets manifest, because it is loaded from nuget folder, whereas other framework assets are loaded from bin/wwwroot/_framework folder.
- The folder is correctly mapped in SWA manifest
- The file name including fingerprint matches what's in file system

It doesn't work for `UseBlazorFrameworkFiles("/...")` as well

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.