Skip to content

Start + Rsbuild: plugin forces server.compress: false, overriding user config #8544

Closed

Description

@glekner

The Rsbuild plugin merges server.compress: false over the user config, so dev responses are never gzipped, even with compress: true.

Repro

// rsbuild.config.ts
export default defineConfig({
  server: { compress: true },
  plugins: [pluginReact(), tanstackStart()],
})

Run rsbuild dev, then curl -sI -H 'Accept-Encoding: gzip' localhost:3000/assets/js/index.js.

Expected

Content-Encoding: gzip (Rsbuild's default, and set explicitly here).

Actual

No encoding. The dev index.js of a minimal app is 1.9 MB instead of 432 kB.

Possible fix

The override (plugin.ts#L253-L255) came from #7348 for #7344. Rsbuild fixed that bug in 2.0.5 (web-infra-dev/rsbuild#7613). With the override removed on 2.2.10, SSR headers are correct. Streamed responses are still buffered until the stream ends, because srvx's sendNodeResponse never calls res.flush(). Rsbuild's gzip middleware added res.flush() in 2.2.10 (web-infra-dev/rsbuild#8533). In my test, calling res.flush?.() after each res.write in the SSR middleware (server-middleware.ts#L151) fixed the buffering. #8137 still keeps the override.

Workaround

Add api.modifyRsbuildConfig({ order: 'post', handler: (c) => { c.server = { ...c.server, compress: true } } }). Streamed responses then arrive in one piece at the end.

Versions

@tanstack/react-start 1.168.59 (start-plugin-core 1.171.48, same on main at 41ebd28), @rsbuild/core 2.2.10, Node 24.16.

Activity

  1. avinash-git-24 commented on Sep 28, 2026

    @avinash-git-24

    Hey team, I noticed packages/start-plugin-core/src/rsbuild/plugin.ts still hardcodes server: { compress: false } in mergeRsbuildConfig. Happy to open a PR removing that override and flushing streamed SSR chunks if you'd like!

  2. jkugsiya commented on Oct 6, 2026

    @jkugsiya

    Hi, I'd like to pick this up if nobody else is on it (@avinash-git-24, are you still planning a PR?).

    Plan: remove the forced compress: false and flush after each write in the SSR middleware so streamed responses aren't held back.

    One question: the plugin accepts any @rsbuild/core 2.x, but the header fix landed in 2.0.5 and the gzip flush in 2.2.10. Should I raise the minimum version, or keep the override for older versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions