The Rsbuild plugin merges server.compress: false over the user config, so dev responses are never gzipped, even with compress: true.
Repro#
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.
Hey team, I noticed
packages/start-plugin-core/src/rsbuild/plugin.tsstill hardcodesserver: { compress: false }inmergeRsbuildConfig. Happy to open a PR removing that override and flushing streamed SSR chunks if you'd like!