Include javascript files associated with Blazor components when using MapStaticAssets #59038
Open
1 task done
Labels
area-blazor
Includes: Blazor, Razor Components
bug
This issue describes a behavior which is not expected - a bug.
Milestone
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I noticed that javascript files associated with Blazor components are not being included as static assets in .NET 9 after calling MapStaticAssets(). It'd be great to get these automatically fingerprinted with an immutable cache-control as well. Loving static assets otherwise!
I generally locate javascript files associated with Blazor components in the same folder and load the module as follows.
module = await js.InvokeAsync<IJSObjectReference>("import", "./_content/MyRazorComponentLibrary/Components/MyComponent.razor.js")
I tried simply moving MyComponent.razor.js to "wwwroot\js" and loading the module from there however I then ran into the following error.
error BLAZOR106: The JS module file '----\wwwroot\js\MyComponent.razor.js' was defined but no associated razor component or view was found for it.
Describe the solution you'd like
Automatically include all javascript files associated with Blazor components as static assets by default
Additional context
No response
The text was updated successfully, but these errors were encountered: