feat: add ESM static component assets#360
Merged
Merged
Conversation
0520ee8 to
52549a3
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add Playwright coverage for lazy component asset loading and cache reuse, wire the example into xtask e2e and demo packaging, and document the create-example workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0093cc1 to
2dbaf0f
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Qusic
previously approved these changes
Jun 23, 2026
Qusic
reviewed
Jun 23, 2026
Qusic
reviewed
Jun 23, 2026
Qusic
reviewed
Jun 23, 2026
This was referenced Jun 23, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Qusic
approved these changes
Jun 23, 2026
akroshg
approved these changes
Jun 23, 2026
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.
Summary
Adds ESM static component assets so WebUI apps can keep the initial SSR payload small while loading deferred component trees asynchronously from a CDN or static folder without
@microsoft/webui-routerand without a template server.webui build --emit-component-assets <tags>compiles requested lazy roots through synthetic non-entry fragments, keeping them out of the initial SSR entry graph while still emitting their full component dependency closure as static.webui.jsmodules.What changed
lazy-panel.webui.js.@microsoft/webui-framework/component-asset.jswithdefineComponentAssets().setState()by default, with optional bounded data blocking.BuildOptions::component_asset_rootsrequests asset roots.BuildResult::component_asset_filesreturns rendered[filename, ESM content]files.render_component_assets()exposes the renderer for Rust callers.build_to_disk()writes component assets alongsideprotocol.binand CSS files.componentAssetRoots.build()returns flattenedcomponentAssetFiles([filename, content, ...]) in addition tocssFiles.[name],[hash],[ext]for Link-mode CSS files and static component assets.[ext]resolves tocssfor CSS andwebui.jsfor component assets..webui.jsmodules out of preload/link handling; only CSS assets use the existing CSS preload/link paths.protocol.bin.examples/app/component-assetsshowing a no-router, no-template-server deferred component flow.Follow-ups filed
Validation
cargo test -p microsoft-webui -p microsoft-webui-cli --libcargo test -p microsoft-webui-clicargo test -p microsoft-webui-node --libcd packages/webui && pnpm build && pnpm testcargo xtask fmtcargo xtask clippy