Skip to content
Source
Sign inSign up
TanStack/router

fix(start-plugin-core): keep the app's server.compress on Rsbuild #8863

MergedSheraff(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/8863/headmerged by Sheraff(GitHub profile, opens in a new tab)

What

The Rsbuild Start plugin always set server.compress: false, so server: { compress: true } in an app's Rsbuild config had no effect (#8544). Now the plugin sets false only when the app leaves server.compress unset. Compression stays off by default because a compressed streamed page reaches the browser only once the stream ends: the SSR middleware's srvx response never flushes the compression middleware.

This change comes from #8817 (packages/start-plugin-core/src/rsbuild/plugin.ts), with one difference. #8817 checks rsbuildConfig.server?.compress === undefined, but that never matches. Rsbuild merges its defaults (compress: true) into the config before modifyRsbuildConfig runs (withDefaultConfig in createRsbuild, on 2.2.5 and on #8817's 2.2.14). So with #8817's code, compression would be on by default in dev. This PR reads the app's own value with Rsbuild's public api.getRsbuildConfig('original').

Now that compress: true takes effect, the optional @rsbuild/core peer of start-plugin-core, react-start, solid-start and vue-start goes from ^2.0.0 to ^2.0.5. Rsbuild 2.0.0–2.0.4 corrupted SSR response headers when compressing (fixed in web-infra-dev/rsbuild#7613). The lockfile doesn't change.

Fixes #8544

Tests

tests/rsbuild/server-compress.test.ts runs createRsbuild with the Start plugin, calls initConfigs({ action: 'dev' }), then reads getNormalizedConfig().server.compress:

casemain#8817's checkthis PR
unset → falsepassfail (true)pass
compress: true → truefail (false)passpass
compress: false → falsepasspasspass

main has no dev-server test harness in start-plugin-core yet, so I checked the response by hand on e2e/react-start/basic with rsbuild dev:

  • with server: { compress: true }, / answers 200, text/html, Content-Encoding: gzip, and the decompressed page has the home route's content;
  • with the default config, the response isn't compressed.

Validation

Run locally with Node 26.12.1, a frozen install, through Nx:

  • pnpm format;
  • start-plugin-core: test:unit (50 files, 877 tests), test:types, test:eslint and test:build pass (re-run after the peer change, with test:build of react-start, solid-start and vue-start);
  • tanstack-react-start-e2e-basic: the Rsbuild modes ssr, ssr--iife, spa, prerender and preview pass;
  • tanstack-react-start-e2e-hmr: test:e2e--rsbuild-ssr passes (it runs rsbuild dev);
  • bundle size: no change. react-start.rsbuild.minimal, minimal-iife and full are byte-identical to main, file hashes included. The change only touches dev-server config.

Merging into #8817

Merging this branch into #8817's head adds one conflict to the ones main already has:

  • packages/start-plugin-core/src/rsbuild/plugin.ts, the compress condition: take this PR's side (api.getRsbuildConfig('original')).
  • the @rsbuild/core peer line in the package.json of start-plugin-core, react-start, solid-start and vue-start: take #8817's ^2.2.13.

After that, #8817 should drop:

  • the server.compress clause in .changeset/start-compiler-yuku.md (line 43), keeping the spa.enabled / #8543 part;
  • the "server.compress is no longer forced" bullet and Closes #8544 in its description.

#8817's dev-server-config.test.ts covers compress: true only. A default-off case there would have caught the difference above.

#8543 (the SPA shell in Rsbuild dev, the other half of this split item) isn't in this PR: #8805 already fixes it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • The Rsbuild plugin now honors an explicitly configured server compression setting. Compression remains off by default when no setting is specified.
    • With compression enabled, streamed pages reach the browser after the stream ends.
  • Compatibility
    • The optional Rsbuild integration now requires Rsbuild 2.0.5 or later.
    1. changeset-bot[bot](GitHub profile, opens in a new tab)commented

      🦋 Changeset detected

      Latest commit: ba6cf0e6c90fda9bb191709a8c4cb5d13470b0f2

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 5 packages
      NameType
      @tanstack/start-plugin-corePatch
      @tanstack/react-startPatch
      @tanstack/solid-startPatch
      @tanstack/vue-startPatch
      @tanstack/react-start-rscPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core

    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Walkthrough

      The Rsbuild plugin now defaults server.compress to false only when the app configuration leaves it unset. Tests cover the default and explicit true and false settings. The optional @rsbuild/core peer minimum is now ^2.0.5 in four package manifests.

      Changes: Rsbuild server compression

      Layer / File(s)Summary
      Preserve configured compression
      packages/start-plugin-core/src/rsbuild/plugin.ts, packages/start-plugin-core/tests/rsbuild/server-compress.test.ts, packages/*-start/package.json, packages/start-plugin-core/package.json, .changeset/rsbuild-server-compress.md
      The plugin sets server.compress to false when the app leaves it unset and preserves explicit values. Tests cover unset, true, and false values. The package manifests set the optional @rsbuild/core peer minimum to ^2.0.5. The changeset records patch releases and describes compression behavior.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Medium

      Suggested reviewers: schiller-manuel

      Merge Risk: Minimal · up to ba6cf

      Compression behavior matches the requested app configuration semantics, and the incompatible Rsbuild versions are excluded.

      Pre-merge checks: Passed 4 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Docstring CoverageWarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 4 passed
      Check nameStatusExplanation
      Title checkPassedThe title names the changed component (start-plugin-core) and the behavior change (keeping the app's server.compress on Rsbuild). The raw summary shows the plugin now honors an explicit server.compres…
      Description checkPassedThe description covers the required template sections. The Changes section explains the motivation (#8544), the default-off behavior, and why the approach differs from #8817. The checklist is not tick…
      Linked Issues checkPassedDirectly linked issue #8544 is the only active target. Its coding objective is that Start's Rsbuild plugin must not override an app's server.compress: true. The whole-PR diff of `packages/start-plug…
      Out of Scope Changes checkPassedAll changes support #8544. The plugin.ts change implements the server.compress behavior. The new server-compress.test.ts tests that behavior. The changeset records the patch release for start-pl…
      Full details: Title check

      Explanation

      The title names the changed component (start-plugin-core) and the behavior change (keeping the app's server.compress on Rsbuild). The raw summary shows the plugin now honors an explicit server.compress value instead of always forcing false, so the title matches the main change. It is specific and concise, with no vague terms.

      Full details: Description check

      Explanation

      The description covers the required template sections. The Changes section explains the motivation (#8544), the default-off behavior, and why the approach differs from #8817. The checklist is not ticked, and the Release Impact section is not ticked. The AI-authorship disclosure is present, since the description states it was generated with Claude Code. The description also includes tests and validation details. The Release Impact checkbox is unticked, but the raw summary shows a changeset was added, so the author likely meant to tick it.

      Full details: Linked Issues check

      Explanation

      Directly linked issue #8544 is the only active target. Its coding objective is that Start's Rsbuild plugin must not override an app's server.compress: true. The whole-PR diff of packages/start-plugin-core/src/rsbuild/plugin.ts reads api.getRsbuildConfig('original').server?.compress. It sets compress: false only when that value is undefined. Explicit true and false values pass through unchanged. tests/rsbuild/server-compress.test.ts covers the unset, true, and false cases. The issue's streamed-response flushing proposal (res.flush?.() in server-middleware.ts) is not in this PR. The PR description states that the SSR middleware does not flush the compression middleware. The issue presents flushing as a possible fix, not as the stated expected behavior, so its absence does not fail this objective. The head packages/start-plugin-core/package.json sets the optional @rsbuild/core peer to ^2.0.5. This matches the compatibility change that makes enabled compression safe for SSR headers. Default-off behavior for unset config is a deliberate choice documented in the code and PR description. The issue's Expected line mentions Rsbuild's default, but the issue's stated requirement concerns explicit app settings. Limitation: the incremental diff from the previous reviewed head could not be read because changed blobs are missing from the checkout. The current head file contents were used instead.

      Full details: Out of Scope Changes check

      Explanation

      All changes support #8544. The plugin.ts change implements the server.compress behavior. The new server-compress.test.ts tests that behavior. The changeset records the patch release for start-plugin-core, react-start, solid-start, and vue-start. The @rsbuild/core peer range change to ^2.0.5 in start-plugin-core, react-start, solid-start, and vue-start is required so that enabled compression does not corrupt SSR headers. The PR description states that the SPA-shell fix for #8543 is excluded, and the diff does not include it. No unrelated production behavior change was found in the whole-PR plugin diff. Limitation: the incremental diff since the previous reviewed head could not be read. The peer-range change was confirmed in the head package.json file.

      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files. (5 skipped: 5 unsupported.)

      Resolution

      Write docstrings for the functions missing them to satisfy the coverage threshold.

      Finishing Touches
      Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      Share

      CodeRabbit Verify

      • Run CodeRabbit Verify to test the changes in this pull request.
      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between ca966f856341721702c39ed6c5de93c08c2c156e and ba6cf0e6c90fda9bb191709a8c4cb5d13470b0f2.

      Files selected for processing: 5
      • .changeset/rsbuild-server-compress.md
      • packages/react-start/package.json
      • packages/solid-start/package.json
      • packages/start-plugin-core/package.json
      • packages/vue-start/package.json
      Files skipped from review as they are similar to previous changes: 1
      • .changeset/rsbuild-server-compress.md

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

    4. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit ba6cf0e6c90fda9bb191709a8c4cb5d13470b0f2

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded17m 7sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-11-03 21:17:15 UTC

      • Fix comments: Fix CodeRabbit comments on this PR
    5. Bundle Size Benchmarks

      This pull request does not affect bundle size in any measured scenario.

    6. github-actions[bot](GitHub profile, opens in a new tab)commented

      🚀 Changeset Version Preview

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

      🟨 Minor bumps

      PackageVersionReason
      @tanstack/router-cli1.167.46 → 1.168.0Changeset
      @tanstack/router-generator1.167.46 → 1.168.0Changeset
      @tanstack/router-plugin1.168.48 → 1.169.0Changeset
      @tanstack/router-utils1.162.4 → 1.163.0Changeset

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/react-start1.169.4 → 1.169.5Changeset
      @tanstack/solid-start1.169.4 → 1.169.5Changeset
      @tanstack/start-plugin-core1.171.55 → 1.171.56Changeset
      @tanstack/vue-start1.169.4 → 1.169.5Changeset
      @tanstack/react-start-rsc0.1.65 → 0.1.66Dependent
      @tanstack/router-vite-plugin1.167.48 → 1.167.49Dependent
    7. pkg-pr-new[bot](GitHub profile, opens in a new tab)commented
      More templates

      @tanstack/arktype-adapter

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

      @tanstack/eslint-plugin-router

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

      @tanstack/eslint-plugin-start

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

      @tanstack/history

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

      @tanstack/react-router

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

      @tanstack/react-router-devtools

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

      @tanstack/react-router-ssr-query

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

      @tanstack/react-start

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

      @tanstack/react-start-client

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

      @tanstack/react-start-rsc

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

      @tanstack/react-start-server

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

      @tanstack/router-cli

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

      @tanstack/router-core

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

      @tanstack/router-devtools

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

      @tanstack/router-devtools-core

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

      @tanstack/router-generator

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

      @tanstack/router-plugin

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

      @tanstack/router-ssr-query-core

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

      @tanstack/router-utils

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

      @tanstack/router-vite-plugin

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

      @tanstack/solid-router

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

      @tanstack/solid-router-devtools

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

      @tanstack/solid-router-ssr-query

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

      @tanstack/solid-start

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

      @tanstack/solid-start-client

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

      @tanstack/solid-start-server

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

      @tanstack/start-client-core

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

      @tanstack/start-fn-stubs

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

      @tanstack/start-plugin-core

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

      @tanstack/start-server-core

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

      @tanstack/start-static-server-functions

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

      @tanstack/start-storage-context

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

      @tanstack/valibot-adapter

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

      @tanstack/virtual-file-routes

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

      @tanstack/vue-router

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

      @tanstack/vue-router-devtools

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

      @tanstack/vue-router-ssr-query

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

      @tanstack/vue-start

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

      @tanstack/vue-start-client

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

      @tanstack/vue-start-server

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

      @tanstack/zod-adapter

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

      commit: ba6cf0e

    8. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: react-start

    9. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: solid-start

    10. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-start

    11. codspeed[bot](GitHub profile, opens in a new tab)commented

      Merging this PR will not alter performance

      1 warning

      :warning: 52 benchmarks are dominated by system calls

      System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

      Learn more about system calls

      See affected benchmarks

      ✅ 194 untouched benchmarks ⏩ 3 skipped benchmarks1


      Comparing start-plugin-core/rsbuild-server-compress (ba6cf0e) with main (ad5b3b7) Open in CodSpeed

      Footnotes

      1. 3 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. ↩

Sign in to join this conversation.