-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[browser] Generate javascript bundler friendly Blazor JS initializers #116849
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] Generate javascript bundler friendly Blazor JS initializers #116849
Conversation
|
Tagging subscribers to 'arch-wasm': @lewing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Blazor boot JSON generation to produce bundler-friendly JS initializers.
- Swaps
libraryInitializersfrom a dictionary to aList<JsAsset>in the JSON model - Updates the builder helper to map
libraryInitializersusingMapJsAssetswith a subfolder path
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| BootJsonData.cs | Changed type of libraryInitializers from ResourceHashesByNameDictionary to List<JsAsset> |
| BootJsonBuilderHelper.cs | Updated assignment of libraryInitializers to use MapJsAssets for bundler compatibility |
Comments suppressed due to low confidence (2)
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs:259
- There are no existing unit tests that cover the new bundler-friendly mapping of
libraryInitializers. Add or update tests to verify that JS assets are correctly generated and serialized in different scenarios.
assets.libraryInitializers = MapJsAssets(resources.libraryInitializers, subFolder: "..");
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs:259
- Changing
libraryInitializersfrom a dictionary to a list alters lookup complexity from O(1) to O(n). Verify that consumers of the generated JSON do not rely on dictionary-style key lookups or consider retaining an in-memory dictionary for efficient access.
assets.libraryInitializers = MapJsAssets(resources.libraryInitializers, subFolder: "..");
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs
Outdated
Show resolved
Hide resolved
|
/backport to release/10.0-preview6 |
|
Started backporting to release/10.0-preview6: https://github.com/dotnet/runtime/actions/runs/15781004801 |
Counterpart to dotnet/aspnetcore#62417.
Generate Blazor JS initializers in way that is compatible with javascript bundlers.