Usable wasm browser apps build output with WasmBundlerFriendlyBootConfig=true#125192
Open
ArcadeMode wants to merge 27 commits intodotnet:mainfrom
Open
Usable wasm browser apps build output with WasmBundlerFriendlyBootConfig=true#125192ArcadeMode wants to merge 27 commits intodotnet:mainfrom
ArcadeMode wants to merge 27 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make WasmBundlerFriendlyBootConfig=true usable in Debug builds by preventing hot reload from being referenced in the generated boot config when no dev server/files are available (e.g., when bundling with a JS bundler).
Changes:
- Adds MSBuild logic to set
WasmEnableHotReload=falsewhenWasmBundlerFriendlyBootConfig=true(under certain conditions).
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@pavelsavara could you look at this if you have a moment? I added a build test to confirm the hotreload references are omitted when building bundler friendly, just in case. |
Contributor
Author
|
Converted to draft, I was doing some things wrong. Will undraft when I got the tests working properly |
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
This was referenced Mar 12, 2026
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Outdated
Show resolved
Hide resolved
...nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets
Show resolved
Hide resolved
Contributor
Author
|
@maraf This is ready for another review. I think there's been some good improvements. |
|
|
||
| <Target Name="EnsureProjectAssetsInOutputDirectoryForBundlerFriendlyBuild" | ||
| BeforeTargets="ResolveBuildStaticWebAssets" | ||
| Condition="'$(WasmBundlerFriendlyBootConfig)' == 'true' and '$(IsPublishing)' != 'true'"> |
Comment on lines
+681
to
+684
| <Target Name="EnsurePublishAssetsInOutputDirectoryForBundlerFriendlyBuild" | ||
| AfterTargets="_SplitStaticWebAssetsByCopyOptions" | ||
| BeforeTargets="_BuildCopyStaticWebAssetsPreserveNewest;_BuildCopyStaticWebAssetsAlways;_BuildCopyStaticWebAssetsIfDifferent" | ||
| Condition="'$(WasmBundlerFriendlyBootConfig)' == 'true' and '$(IsPublishing)' != 'true'"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is currently not possible to use the output of a Wasm Browser App's
dotnet buildwhenWasmBundlerFriendlyBootConfig=true.These two points make it so that builds will fail when passed into an npm project.
Secondary 'issues' (rather improvements)
Changes
Test are updated to always run an npm build when building bundler friendly, so multiple tests verify that this works. A new test was added to explicitly test for the absence of hot reload from the boot json.
Effect
The proposed changes make it no longer necessary to go through a dev cycle with publish + npm builds, instead the (faster) builds can be used for the npm builds. Once ready its ofcourse still possible to publish for a release build (a more typical development flow).