Blazored / Modal

A powerful and customizable modal implementation for Blazor applications.
https://blazored.github.io/Modal/
MIT License
782 stars 185 forks source link

Does not work in blazor server #480

Closed CrownVicPI437 closed 8 months ago

CrownVicPI437 commented 1 year ago

No matter on windows, mac, rider, or visual studio I get this error and cannot get past it on Blazor Server. If I run WASM blazoredmodal has no issues at all. Is there anything that I am messing up or is this not on my end?

Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100] Unhandled exception rendering component: Failed to fetch dynamically imported module: https://localhost:5001/_content/Blazored.Modal/BlazoredModal.razor.js TypeError: Failed to fetch dynamically imported module: https://localhost:5001/_content/Blazored.Modal/BlazoredModal.razor.js Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: https://localhost:5001/_content/Blazored.Modal/BlazoredModal.razor.js TypeError: Failed to fetch dynamically imported module: https://localhost:5001/_content/Blazored.Modal/BlazoredModal.razor.js at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Blazored.Modal.BlazoredModal.OnAfterRenderAsync(Boolean firstRender) in /Users/piercekennedy/Desktop/Work/untitled folder/Modal/src/Blazored.Modal/BlazoredModal.razor:line 70 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111] Unhandled exception in circuit 'CCk5oQYJ3hGMOyU5hkND1t4IZgwfxybf7Y6rWuXDA1Q'. Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: https://localhost:5001/_content/Blazored.Modal/BlazoredModal.razor.js TypeError: Failed to fetch dynamically imported module: https://localhost:5001/_content/Blazored.Modal/BlazoredModal.razor.js at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Blazored.Modal.BlazoredModal.OnAfterRenderAsync(Boolean firstRender) in /Users/piercekennedy/Desktop/Work/untitled folder/Modal/src/Blazored.Modal/BlazoredModal.razor:line 70 at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

adamashton commented 1 year ago

I get a similar error when running in Debug but using a different launch profile configured via launchSettings.json.

Failed to load resource: the server responded with a status of 404 (Not Found)
blazor.server.js:1 [2022-12-22T20:30:41.999Z] Error: Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: http://localhost:5264/_content/Blazored.Modal/BlazoredModal.razor.js
TypeError: Failed to fetch dynamically imported module: http://localhost:5264/_content/Blazored.Modal/BlazoredModal.razor.js
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at Blazored.Modal.BlazoredModal.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Edit: This seemed to help https://github.com/dotnet/AspNetCore.Docs/issues/24053#issuecomment-978038983