Skip to content

fix(start): emit boot-sibling chunks as scripts for IIFE entries#7501

Merged
schiller-manuel merged 3 commits into
mainfrom
fix-iife-rsbuild-single-runtime
May 28, 2026
Merged

fix(start): emit boot-sibling chunks as scripts for IIFE entries#7501
schiller-manuel merged 3 commits into
mainfrom
fix-iife-rsbuild-single-runtime

Conversation

@schiller-manuel
Copy link
Copy Markdown
Collaborator

@schiller-manuel schiller-manuel commented May 28, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Ensure client entry scripts are emitted for IIFE bundles with static-import siblings so hydration works correctly.
  • Chores

    • Update build/test fixture for more extensive development stress-testing.
    • Manifest/public API changes: manifests and TypeScript types no longer expose a top-level clientEntry; manifest shape/asset handling standardized and simplified.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a54baa35-59f4-46f4-be77-54242cbdbd5b

📥 Commits

Reviewing files that changed from the base of the PR and between e2ab690 and 72af98d.

📒 Files selected for processing (1)
  • packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts

📝 Walkthrough

Walkthrough

This PR removes the top-level clientEntry from start manifests, emits client entry scripts via routes.__root__ (respecting scriptFormat for module vs iife), and simplifies server-side APIs to use ServerManifest directly; tests and dev/E2E fixtures were updated accordingly.

Changes

Manifest contract and entry script emission

Layer / File(s) Summary
StartManifest contract removal
packages/start-plugin-core/src/start-manifest-plugin/manifestBuilder.ts
Remove clientEntry: string from the public StartManifest interface and from buildStartManifest's return.
Entry script generation and route append helpers
packages/start-plugin-core/src/start-manifest-plugin/manifestBuilder.ts
Add buildScript, appendRouteScripts, and appendEntryChunkScripts to construct and merge manifest scripts (module vs iife attributes) onto routes.
Wire entry scripts into buildStartManifest
packages/start-plugin-core/src/start-manifest-plugin/manifestBuilder.ts
Attach entry-chunk scripts to routes.__root__ during manifest build; default scriptFormat to 'module'; use shallow copies for missing chunk data.
Update dev virtual modules and fallback manifest
packages/start-plugin-core/src/rsbuild/virtual-modules.ts, packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts
Replace dev fallback { routes: {}, clientEntry } with routes.__root__ containing preloads and scripts whose attrs are generated from scriptFormat; move normalize import to normalized-client-build.
Reorganize Vite manifest helper imports
packages/start-plugin-core/src/start-manifest-plugin/manifestBuilder.ts, packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts
Import normalizeViteClientBuild from normalized-client-build and remove re-exports from manifestBuilder.
Simplify server-core manifest types to ServerManifest
packages/start-server-core/src/finalManifest.ts, packages/start-server-core/src/router-manifest.ts, packages/start-server-core/src/tanstack-start.d.ts
Change GetBaseManifest and related functions to return Promise<ServerManifest>; remove StartManifestWithClientEntry re-exports; add internal buildFinalManifest to choose transforms.
Remove ClientEntry helpers from asset transformation
packages/start-server-core/src/transformAssetUrls.ts
Remove StartManifestWithClientEntry and buildClientEntryScriptTag; make transformManifestAssets accept ServerManifest and stop injecting client entry; add buildManifest that deep-clones inlineCss without adding client entry.

Test updates for manifest refactors

Layer / File(s) Summary
Update start-manifest-plugin tests
packages/start-plugin-core/tests/start-manifest-plugin.test.ts, packages/start-plugin-core/tests/start-manifest-plugin/manifestBuilder.test.ts
Adjust tests to expect src/attrs on root-route script entries; update imports to normalized-client-build; add tests asserting module vs iife root emission and auto-injected client entry scripts.
Update server-core manifest tests
packages/start-server-core/tests/finalManifest.test.ts, packages/start-server-core/tests/transformAssets.test.ts
Use ServerManifest fixtures (top-level inlineCss/routes); update to buildManifest; add immutability and deep-clone assertions; validate preload/script ordering for iife and crossOrigin handling.

E2E test fixture and release notes

Layer / File(s) Summary
E2E test rsbuild config for iife output
e2e/react-start/custom-server-rsbuild/rsbuild.config.ts
Expand the e2e rsbuild fixture to produce IIFE client output, enable rspack build cache, set output.assetPrefix to /static/, and force single runtime chunk.
Release notes
.changeset/seven-times-pump.md
Add a changelog entry describing the fix to ensure client entry scripts are emitted from the root route manifest to correct IIFE hydration when entry chunks have static-import siblings.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • TanStack/router#6606: Refactors the transform/manifest pipeline that introduced client-entry–centric APIs this PR removes.
  • TanStack/router#7482: Changes Vite/start-manifest client-entry wiring for bundled-dev; overlaps with manifest emission behavior here.
  • TanStack/router#7477: Introduces rsbuild iife output-work that this PR's scriptFormat handling builds upon.

Suggested reviewers

  • beaussan
  • SeanCassiere

Poem

🐰 I hopped through manifests, scripts in tow,
Rooted the entry where preloads grow,
Module or IIFE, they find their part —
No top-level clutter, a cleaner start!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: addressing IIFE entry handling with boot-sibling chunks being emitted as scripts, which is the core change across the manifest and asset transformation refactoring.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-iife-rsbuild-single-runtime

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 28, 2026

View your CI Pipeline Execution ↗ for commit e2ab690

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 9m 16s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 43s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-28 23:38:42 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

🚀 Changeset Version Preview

2 package(s) bumped directly, 7 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/start-plugin-core 1.171.6 → 1.171.7 Changeset
@tanstack/start-server-core 1.169.4 → 1.169.5 Changeset
@tanstack/react-start 1.168.14 → 1.168.15 Dependent
@tanstack/react-start-rsc 0.1.13 → 0.1.14 Dependent
@tanstack/react-start-server 1.167.9 → 1.167.10 Dependent
@tanstack/solid-start 1.168.14 → 1.168.15 Dependent
@tanstack/solid-start-server 1.167.9 → 1.167.10 Dependent
@tanstack/vue-start 1.168.13 → 1.168.14 Dependent
@tanstack/vue-start-server 1.167.9 → 1.167.10 Dependent

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Bundle Size Benchmarks

  • Commit: 9e152f8b1150
  • Measured at: 2026-05-28T23:30:23.383Z
  • Baseline source: history:bae50be10aed
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.30 KiB 0 B (0.00%) 87.16 KiB 274.03 KiB 75.92 KiB ▃▁▁▁▁██████
react-router.full 90.75 KiB 0 B (0.00%) 90.61 KiB 285.39 KiB 78.80 KiB ███▁▁▂▂▂▂▂▂
solid-router.minimal 35.53 KiB 0 B (0.00%) 35.41 KiB 106.33 KiB 32.01 KiB ▁▆▆▆▆██████
solid-router.full 40.23 KiB 0 B (0.00%) 40.11 KiB 120.52 KiB 36.19 KiB ▇██▂▂▁▁▁▁▁▁
vue-router.minimal 53.02 KiB 0 B (0.00%) 52.89 KiB 150.35 KiB 47.56 KiB █████▁▁▁▁▁▁
vue-router.full 58.65 KiB 0 B (0.00%) 58.52 KiB 168.08 KiB 52.55 KiB ▁▁▁██▅▅▅▅▅▅
react-start.minimal 101.93 KiB 0 B (0.00%) 101.79 KiB 322.35 KiB 88.25 KiB ███▁▁▁▁▁▁▁▁
react-start.deferred-hydration 102.66 KiB 0 B (0.00%) 101.81 KiB 323.72 KiB 88.82 KiB ███▆▆▁▁▁▁▁▁
react-start.full 105.31 KiB 0 B (0.00%) 105.17 KiB 332.66 KiB 91.06 KiB ███▁▁▁▁▁▁▁▁
react-start.rsbuild.minimal 99.61 KiB 0 B (0.00%) 99.44 KiB 316.79 KiB 85.73 KiB ███▁▁▁▁▂▂▂▂
react-start.rsbuild.full 102.88 KiB 0 B (0.00%) 102.71 KiB 327.18 KiB 88.52 KiB ███▁▁▁▁▁▁▁▁
solid-start.minimal 49.63 KiB 0 B (0.00%) 49.50 KiB 152.40 KiB 43.84 KiB ███▁▁▁▁▁▁▁▁
solid-start.deferred-hydration 52.89 KiB 0 B (0.00%) 49.55 KiB 160.44 KiB 46.71 KiB █████▁▁▁▁▁▁
solid-start.full 55.41 KiB 0 B (0.00%) 55.29 KiB 169.33 KiB 48.81 KiB ███▁▁▁▁▁▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7501

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7501

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7501

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7501

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7501

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7501

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7501

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7501

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7501

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7501

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7501

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7501

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7501

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7501

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7501

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7501

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7501

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7501

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7501

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7501

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7501

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7501

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7501

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7501

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7501

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7501

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7501

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7501

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7501

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7501

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7501

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7501

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7501

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7501

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7501

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7501

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7501

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7501

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7501

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7501

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7501

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7501

commit: 72af98d

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

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

Nx Cloud is proposing a fix for your failed CI:

We moved the normalizeViteClientBuild value import above the import type statements in plugin.ts to fix the import/order ESLint violation introduced by the PR. The rule requires all value imports to precede type-only imports, and the new import was accidentally placed after them. This change restores lint compliance without altering any runtime behaviour.

Tip

We verified this fix by re-running @tanstack/start-plugin-core:test:eslint.

diff --git a/packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts b/packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts
index 5701ab1e..9b9c2745 100644
--- a/packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts
+++ b/packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts
@@ -8,9 +8,9 @@ import {
   serializeStartManifest,
 } from '../../start-manifest-plugin/manifestBuilder'
 import { createVirtualModule } from '../createVirtualModule'
+import { normalizeViteClientBuild } from './normalized-client-build'
 import type { GetConfigFn, NormalizedClientBuild } from '../../types'
 import type { PluginOption, Rollup } from 'vite'
-import { normalizeViteClientBuild } from './normalized-client-build'
 
 type StartManifestEnvironment = {
   config: {

Apply fix via Nx Cloud  Reject fix via Nx Cloud


Or Apply changes locally with:

npx nx-cloud apply-locally KJTU-Ey4N

Apply fix locally with your editor ↗   View interactive diff ↗



🎓 Learn more about Self-Healing CI on nx.dev

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 28, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing fix-iife-rsbuild-single-runtime (72af98d) with main (bae50be)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@schiller-manuel schiller-manuel merged commit 9c09bca into main May 28, 2026
19 checks passed
@schiller-manuel schiller-manuel deleted the fix-iife-rsbuild-single-runtime branch May 28, 2026 23:42
@github-actions github-actions Bot mentioned this pull request May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants