Repository navigation
Conversation
Match the Rsbuild hosts and the README's advice.
commit: |
This branch has not been deployed
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
TanStack Start 1.169 added
<Hydrate>, which keeps server-rendered markup and loads a component's code only when a trigger fires (for example, when it scrolls into view). We checked whether it works with remotes, and it does without adapter changes: the server still renders the remote inline, and the browser loads the remote's code after the trigger.One condition applies. With Module Federation's default
version-firstshare strategy, a host loads every remote's manifest and entry at startup, so<Hydrate>can defer only the exposed module's chunks. The Vite example host was the only host still on that default, so this PR switches it toloaded-firstand documents how to use<Hydrate>with remotes. No package code changes.Changes
1. Use
loaded-firstin the Vite example hostapps/vite-hosthad noshareStrategy, against the README's own advice. It now matches both Rsbuild hosts. The README also said one offline remote "fails the whole page" underversion-first, which is true for Rsbuild hosts but not for the Vite host. It now describes each host. Measured with production builds and one remote offline:version-firstloaded-first2. Document deferring remote hydration
A new README section, "Deferring remote hydration", with an example and these notes:
loaded-first, only the remotes' stylesheets load before the trigger.preload()would load the remote right away. Preloading only on the server keeps SSR inline and defers it in the browser.prefetchloads only the host's code-split chunk. A function that callspreload()loads the remote;visible()ignores functions.<Hydrate>. The adapter compiles both the browser build and the server container with Start's transform.It also adds a known limitation. In development, an Rsbuild host cannot server-render a Vite remote that imports
@tanstack/react-start, because the Node entry loader resolves@tanstack/router-coresubpaths to the package's main entry. A follow-up PR will fix it and remove the note.Validation
format:check,lint,typecheck: passedtest:core: 92/92test:e2ewith the Vite host onloaded-first: 23/23 (production 11, development 12)apps/vite-host.