Repository navigation
refactor(bundler): target the current Node.js version for server builds, remove the hardcoded 26.0.0 clamp (AI-assisted) - #12781
Conversation
…ds, remove the hardcoded `26.0.0` clamp (AI-assisted) SWC no longer falls back to ES5 for Node.js versions newer than its Browserslist data: it now skips all transforms for them, like Babel (swc-project/swc#11457, shipped in every Rspack 2.x). The server target is the current Node.js version without its pre-release tag, because SWC panics on versions like "27.0.0-rc.1". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
Motivation
Since #11496, the SWC server target is clamped to a hardcoded
node 26.0.0, because SWC used to silently compile down to ES5 when the Node.js target was newer than its embedded Browserslist data.SWC fixed it in swc-project/swc#11457: it now skips all transforms for versions newer than its data, like Babel. Every Rspack 2.x ships the fix, so we can target the current Node.js version again and drop the hardcoded value.
One catch: SWC panics on pre-release versions like
node 27.0.0-rc.1. The clamp hid it for pre-releases above 26.0.0 (26.0.0-prealready crashed), so the target now drops the pre-release tag.Other changes:
getTargets()(added in refactor(bundler): separate the client queries from the client and server targets, remove the SWCclientBrowserslistQueriesparam (AI-assisted) #12778, unreleased) andgetSwcLoaderOptions()no longer take abundlerName: it only existed for the clamp.Rspack still doesn't expose its Browserslist data publicly, but we no longer need it.
Test Plan
DOCUSAURUS_SERVER_NODE_TARGETescape hatchVerification details
using/await using) compiled with the Docusaurus server SWC options. Targetsnode 24.18.0tonode 99.0.0all give byte-identical output, with nothing lowered (thenode 10.0.0control lowers 8 features). The outputs run without crashing on Node.js 24.21.0, 26.1.0, 26.8.1 and 26.9.0.BUILD_FAST, server bundle kept):DOCUSAURUS_SERVER_NODE_TARGET=26.0.0(the former behavior) vs this PR: all 3030 output files byte-identical, server bundle included.process.versions.node = '27.0.0-rc.1': builds all 980 pages. It differs only by build noise (the debug content page order varies between runs).DOCUSAURUS_SERVER_NODE_TARGET=99.0.0: builds all 980 pages.preset_env_base7.0.0 and 9.0.0, which both include the fix.Test links
Deploy preview: https://deploy-preview-12781--docusaurus-2.netlify.app/
Related issues/PRs
clientBrowserslistQueriesparam (AI-assisted) #12778 and fix(core): evict the bundler persistent cache when the target browsers, the server Node.js target or plugin versions change (AI-assisted) #12774 moved the server target togetTargets()and the cache key🤖 Generated with Claude Code
Summary by CodeRabbit
DOCUSAURUS_SERVER_NODE_TARGETto select a different target. Server targets no longer vary based on the bundler, helping keep server build compatibility consistent across bundler choices.