Skip to content

[browser] Assembly search path should be relative to the blazor.boot.json, not the importing module. #99539

@onionhammer

Description

@onionhammer

Description

When finding .wasm files in detect_features_and_polyfill, the scriptUrlQuery variable is derived from the importing module (import.meta.url) instead of where the blazor.boot.json file is, and there does not appear to be any way to configure it to look in a different path.

This means that bundlers which generate a module which imports the dotnet runtime will struggle to put the generated module into a _framework folder alongside the rest of the .NET/wasm assets.

Reproduction Steps

Create a vite project, import a .NET wasm assembly based project, build the vite project.

Expected behavior

The default behavior for loading .wasm files should be that it loads from the same directory as the blazor.boot.json file, or else provide a configuration (ala ".withConfigSource()") which allows the caller to specify where the .wasm files are stored.

Actual behavior

the bundled javascript attempts to load the .wasm from whatever path it's currently on.

loader/polyfills.ts:42

image

without any possibility to configure where the assemblies actually are; i.e. "./" instead of "./_framework/*"

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions