Skip to content

fix: disabled topLevelVar#7293

Merged
schiller-manuel merged 2 commits intomainfrom
topLevelVar
Apr 29, 2026
Merged

fix: disabled topLevelVar#7293
schiller-manuel merged 2 commits intomainfrom
topLevelVar

Conversation

@schiller-manuel
Copy link
Copy Markdown
Contributor

@schiller-manuel schiller-manuel commented Apr 29, 2026

this will cause isServer not to be transpiled to var and thus rspack can properly DCE

Summary by CodeRabbit

  • Bug Fixes
    • Fixed build output configuration to properly preserve critical exports during dead-code elimination, ensuring correct behavior with rspack bundler.

this will cause isServer not to be transpiled to `var` and thus rspack can properly DCE
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Apr 29, 2026

View your CI Pipeline Execution ↗ for commit 9608c2c

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

☁️ Nx Cloud last updated this comment at 2026-04-29 20:02:46 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

🚀 Changeset Version Preview

1 package(s) bumped directly, 22 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/router-core 1.168.17 → 1.168.18 Changeset
@tanstack/react-router 1.168.25 → 1.168.26 Dependent
@tanstack/react-start 1.167.51 → 1.167.52 Dependent
@tanstack/react-start-client 1.166.43 → 1.166.44 Dependent
@tanstack/react-start-rsc 0.0.30 → 0.0.31 Dependent
@tanstack/react-start-server 1.166.44 → 1.166.45 Dependent
@tanstack/router-cli 1.166.37 → 1.166.38 Dependent
@tanstack/router-generator 1.166.36 → 1.166.37 Dependent
@tanstack/router-plugin 1.167.28 → 1.167.29 Dependent
@tanstack/router-vite-plugin 1.166.43 → 1.166.44 Dependent
@tanstack/solid-router 1.168.25 → 1.168.26 Dependent
@tanstack/solid-start 1.167.48 → 1.167.49 Dependent
@tanstack/solid-start-client 1.166.42 → 1.166.43 Dependent
@tanstack/solid-start-server 1.166.43 → 1.166.44 Dependent
@tanstack/start-client-core 1.167.20 → 1.167.21 Dependent
@tanstack/start-plugin-core 1.169.6 → 1.169.7 Dependent
@tanstack/start-server-core 1.167.22 → 1.167.23 Dependent
@tanstack/start-static-server-functions 1.166.36 → 1.166.37 Dependent
@tanstack/start-storage-context 1.166.31 → 1.166.32 Dependent
@tanstack/vue-router 1.168.21 → 1.168.22 Dependent
@tanstack/vue-start 1.167.44 → 1.167.45 Dependent
@tanstack/vue-start-client 1.166.38 → 1.166.39 Dependent
@tanstack/vue-start-server 1.166.39 → 1.166.40 Dependent

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 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: dcc7d638-5314-48f4-adcf-eaec29b610a4

📥 Commits

Reviewing files that changed from the base of the PR and between d406d1a and 5b47836.

📒 Files selected for processing (2)
  • .changeset/slow-seahorses-grab.md
  • packages/router-core/vite.config.ts

📝 Walkthrough

Walkthrough

This PR adds configuration changes for the router-core package to preserve isServer exports during build by disabling the topLevelVar transformation. A Changeset entry documents this patch-level fix intended to enable rspack dead-code elimination.

Changes

Cohort / File(s) Summary
Build Configuration & Metadata
.changeset/slow-seahorses-grab.md, packages/router-core/vite.config.ts
Added Changeset documenting patch-level fix for isServer export preservation, and updated Vite configuration to disable topLevelVar transformation to support rspack dead-code elimination.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A changeset hops in with cheer,
Vite configs crystal and clear,
Top-level vars? We bid adieu,
Dead code vanishes on cue!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: disabled topLevelVar' directly corresponds to the main change in the PR, which disables the topLevelVar behavior in the Vite configuration to enable proper dead code elimination.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 topLevelVar

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

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

@github-actions
Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: d406d1a45076
  • Measured at: 2026-04-29T19:55:00.693Z
  • Baseline source: history:d6decca41807
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend
react-router.minimal 87.30 KiB 0 B (0.00%) 274.68 KiB 75.83 KiB ████████▁▁▁
react-router.full 90.80 KiB 0 B (0.00%) 286.19 KiB 79.00 KiB ▁▁▁▁▁▁▁▁███
solid-router.minimal 35.55 KiB 0 B (0.00%) 106.95 KiB 31.97 KiB ▁▁▁▁████▁▁▁
solid-router.full 40.28 KiB 0 B (0.00%) 121.16 KiB 36.16 KiB ▁▁▁▁▄███▄▄▄
vue-router.minimal 53.30 KiB 0 B (0.00%) 152.09 KiB 47.88 KiB ████████▁▁▁
vue-router.full 58.44 KiB 0 B (0.00%) 168.27 KiB 52.33 KiB ▁▁▁▁▁▁▁▁███
react-start.minimal 101.92 KiB 0 B (0.00%) 322.84 KiB 88.06 KiB ▁▁▁▁▁▁▁▁███
react-start.full 105.34 KiB 0 B (0.00%) 333.17 KiB 90.98 KiB ████████▁▁▁
react-start.rsbuild.minimal 99.53 KiB -1.92 KiB (-1.90%) 317.16 KiB 85.62 KiB ███████████▁
react-start.rsbuild.full 102.84 KiB -1.91 KiB (-1.83%) 327.59 KiB 88.41 KiB ███████████▁
solid-start.minimal 49.55 KiB 0 B (0.00%) 152.77 KiB 43.68 KiB ▁▁▁▁████▂▂▂
solid-start.full 55.33 KiB 0 B (0.00%) 169.68 KiB 48.71 KiB ▁▁▁▁▃███▅▅▅

Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 29, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 5b47836

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 29, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing topLevelVar (5b47836) with main (d6decca)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

  2. No successful run was found on main (d406d1a) during the generation of this report, so d6decca was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@schiller-manuel schiller-manuel merged commit b5c4183 into main Apr 29, 2026
17 checks passed
@schiller-manuel schiller-manuel deleted the topLevelVar branch April 29, 2026 20:15
build: {
rolldownOptions: {
output: {
topLevelVar: false,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

According to the document here: https://rolldown.rs/reference/OutputOptions.topLevelVar

It is default to ‘false’.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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