Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
onionhammer opened this issue Mar 11, 2024 · 1 comment
Assignees
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm
Milestone

Comments

@onionhammer
Copy link

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

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 11, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Mar 11, 2024
@jeffschwMSFT jeffschwMSFT added arch-wasm WebAssembly architecture area-VM-meta-mono labels Mar 12, 2024
@vcsjones vcsjones removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 12, 2024
@maraf
Copy link
Member

maraf commented Mar 13, 2024

You have several workarounds at the moment

  • You can set <WasmRuntimeAssetsLocation>./</WasmRuntimeAssetsLocation> MSBuild property to skip putting wasm runtime assets to _framework folder.
  • You can use withResourceLoader to modify on runtime a location where it loads assets from.

We are looking into making the wasm app structure more bundler friendly. Inlining boot config or #86162 are one of the things

@maraf maraf added this to the 9.0.0 milestone Mar 13, 2024
@maraf maraf removed the untriaged New issue has not been triaged by the area owner label Mar 13, 2024
@maraf maraf changed the title WASM: Assembly search path should be relative to the blazor.boot.json, not the importing module. [browser] Assembly search path should be relative to the blazor.boot.json, not the importing module. Apr 22, 2024
@maraf maraf modified the milestones: 9.0.0, 10.0.0 Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm
Projects
None yet
Development

No branches or pull requests

4 participants