abp icon indicating copy to clipboard operation
abp copied to clipboard

Bundling of blazor.webassembly.js conflicts with asp.net hosting behaviour

Open BenWhite27 opened this issue 3 years ago • 0 comments

  • 6.0.0-rc.2
  • Blazor WebAssembly
  • EF Core

When a Blazor app is hosted via asp.net core, a middleware is used to host the framework files (app.UseBlazorFrameworkFiles()). This middleware relies on an HTTP request to _framework\blazor_webassembly.js to set some response headers that communicate the environment to the Blazor runtime as well as some other headers for hot reload. See: ComponentsWebAssemblyApplicationBuilderExtensions.cs

As the abp bundle command injects the blazor.webassembly.js BundleDefinition after all contributors have been evaluated there doesn't appear to be an opportunity to override this behaviour and exclude this particular JS file from the bundle.

I believe a better design would be to have the script added in the startup template bundle contributor instead of the abp cli. It would also be useful if the docs indicated that when hosting the Blazor UI project in an asp.net core host the script should be removed and obtained from the server.

BenWhite27 avatar Aug 12 '22 22:08 BenWhite27