Skip to content

Usable wasm browser apps build output with WasmBundlerFriendlyBootConfig=true#125192

Open
ArcadeMode wants to merge 27 commits intodotnet:mainfrom
ArcadeMode:wasm-no-hotreload-with-bundlerfriendlybootconfig
Open

Usable wasm browser apps build output with WasmBundlerFriendlyBootConfig=true#125192
ArcadeMode wants to merge 27 commits intodotnet:mainfrom
ArcadeMode:wasm-no-hotreload-with-bundlerfriendlybootconfig

Conversation

@ArcadeMode
Copy link
Contributor

@ArcadeMode ArcadeMode commented Mar 4, 2026

It is currently not possible to use the output of a Wasm Browser App's dotnet build when WasmBundlerFriendlyBootConfig=true.

  • Hotreload is still referenced from the generated boot.config.json. However there wont be a server involved to provide the files, nor are they present on disk.
  • Static assets are not copied from wwwroot to the output directory

These two points make it so that builds will fail when passed into an npm project.

Secondary 'issues' (rather improvements)

  • Compression is also enabled by default, slowing the build down while the js bundler most likely wont be using these files.
  • Fingerprinting is also enabled by default, which the bundler can to (and often does) by itself.

Changes

  • defaulted the aforementioned properties to false when building bundler friendly
  • ammended static asset sdk 'default items' Content with instruction to also copy to the output directory on build.

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).

Copilot AI review requested due to automatic review settings March 4, 2026 21:51
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 4, 2026
Copy link
Contributor

Copilot AI left a 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 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=false when WasmBundlerFriendlyBootConfig=true (under certain conditions).

Copilot AI review requested due to automatic review settings March 6, 2026 22:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

@ArcadeMode
Copy link
Contributor Author

ArcadeMode commented Mar 6, 2026

@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.

Copilot AI review requested due to automatic review settings March 6, 2026 23:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

@ArcadeMode ArcadeMode marked this pull request as draft March 7, 2026 12:05
@ArcadeMode
Copy link
Contributor Author

Converted to draft, I was doing some things wrong. Will undraft when I got the tests working properly

Copilot AI review requested due to automatic review settings March 10, 2026 21:55
Copilot AI review requested due to automatic review settings March 11, 2026 18:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings March 11, 2026 22:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings March 12, 2026 20:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings March 12, 2026 21:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

@ArcadeMode ArcadeMode requested a review from maraf March 13, 2026 15:25
@ArcadeMode
Copy link
Contributor Author

@maraf This is ready for another review. I think there's been some good improvements.

Copilot AI review requested due to automatic review settings March 13, 2026 16:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


<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'">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Build-mono community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants