Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor WebAssembly Custom Elements fail to load resources after upgrading to .NET 10

$
0
0

I am using Blazor WebAssembly custom elements inside an Angular application via
Microsoft.AspNetCore.Components.CustomElements.

I register the Blazor components like this:
builder.RootComponents.RegisterCustomElement<Counter>("my-counter");

Setup

  • Blazor WebAssembly app running at:
    https://localhost:52007

  • Angular app running at:
    http://localhost:3002

In the Angular app, I manually load the Blazor WebAssembly runtime and resources:

<script  type="application/javascript"  src="https://localhost:52007/_framework/blazor.webassembly.js"  autostart="false"></script><script type="application/javascript">  Blazor.start({    loadBootResource: function (type, name, defaultUri, integrity) {      const url = new URL(defaultUri, "https://localhost:52007");      return `${url}`;    }  });</script>

This setup worked correctly before upgrading .NET. After upgrading to .NET 10, the integration no longer works. I now get the following errors in the browser console:

GET http://localhost:3002/_content/Microsoft.DotNet.HotReload.WebAssembly.Browser/Microsoft.DotNet.HotReload.WebAssembly.Browser.99zm1jdh75.lib.module.js404 (Not Found)MONO_WASM: onConfigLoaded() failedTypeError: Failed to fetch dynamically imported module:http://localhost:3002/_content/Microsoft.DotNet.HotReload.WebAssembly.Browser/Microsoft.DotNet.HotReload.WebAssembly.Browser.99zm1jdh75.lib.module.js

What seems to be happening dotnet.js is loaded correctly from the Blazor app (https://localhost:52007), after that, Blazor attempts to load library initializers from dotnet.js, and those resources are incorrectly fetched from the Angular app origin (http://localhost:3002).

Is there a way to force all Blazor WebAssembly resources to be loaded in Angular app from the Blazor WebAssembly app origin?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>