Skip to content

Framework: Update Node.js to v24 (wp/5.2) - #86870

Draft
sirreal wants to merge 9 commits into
wp/5.2from
build/node-24-wp-5.2
Draft

sirreal wants to merge 9 commits into
wp/5.2from
build/node-24-wp-5.2

Conversation

@sirreal

@sirreal sirreal commented Nov 16, 2026

Copy link
Copy Markdown
Member

What?

Sets .nvmrc to Node.js 24.20 on wp/5.2, as on trunk, and makes the branch install, build and run its unit tests with Node.js 24 and npm 11.

Why?

The wordpress-develop 5.2 branch moves to Node.js 24 in WordPress/wordpress-develop#15701. This branch's CI takes Node.js from .nvmrc, and with only that change npm ci fails on Node.js 24 and npm 11.

How?

  • .nvmrc is 24.20.
  • Package styles build with Dart Sass: the node-sass devDependency (LibSass 4.14.1, which has no Node.js 24 binary and does not compile against it) becomes npm:sass@1.32.8, the sass version WordPress 5.2 uses. bin/packages/build.js passes Sass an importer that returns node_modules/react-dates/lib/css/_datepicker.css as SCSS: Dart Sass reads an imported .css file as plain CSS and rejects its darken() call, which LibSass compiled.
  • A root overrides entry sets node-gyp to 12.4.0, the version npm 11 bundles. deasync, which bin/packages/build.js uses, has no Node.js 24 prebuild and compiles with the node-gyp in node_modules/.bin; the locked 3.8.0 needs Python 2. 12.4.0 is outside the ^3.8.0 range that lerna's npm-lifecycle declares.
  • Backports Build Tooling: Remove WebpackRTLPlugin #15711, which removes webpack-rtl-plugin from package.json and webpack.config.js. npm 11 cannot install the plugin from its git source: it runs the package's prepublish build, and its babel 6 devDependency is a placeholder package with no compiler. bin/packages/build.js already writes each -rtl.css file, which webpack copies, so the build writes the same files as before.
  • build and dev run webpack as node --openssl-legacy-provider ./node_modules/webpack/bin/webpack.js in place of wp-scripts build and wp-scripts start, because webpack 4 hashes with md4, which OpenSSL 3 disables. The wp-scripts commands start webpack in a new process, which a flag on the outer node does not reach. build sets NODE_ENV=production, as wp-scripts build did.
  • test-unit runs @wordpress/scripts' test-unit-js.js with node --openssl-legacy-provider, which is what wp-scripts test-unit-js ran: two test suites run webpack inside Jest.
  • .npmrc sets legacy-peer-deps = true, which keeps npm 6's peer dependency handling.
  • Converts package-lock.json from lockfile version 1 to 3 with npm 11. Installed versions change only through the changes above: node-sass 4.14.1 is replaced by sass 1.32.8 and node-sass's dependencies are removed; node-gyp moves from 3.8.0 to 12.4.0, which moves graceful-fs from 4.1.11 to 4.2.11, nopt from 3.0.6 to 9.0.0, abbrev from 1.1.1 to 4.0.0, tar from 2.2.1 to 7.5.23 and node-gyp's semver from 5.3.0 to 7.8.6, removes block-stream and fstream, and adds 15 entries that node-gyp 12 and tar 7 need; the 11 nested graceful-fs 4.1.15 copies under Jest packages, make-fetch-happen and pacote are removed, so those packages use the hoisted 4.2.11; webpack-rtl-plugin and the packages only it used are removed.

Testing Instructions

With Node.js 24 and npm 11: npm ci && npm run build && npm run test-unit.

The built JavaScript and every other non-CSS file is byte-identical to a Node.js 14 build of wp/5.2, and the unit test results are the same. The built CSS has the same rules; Dart Sass writes them in a different notation: 10 decimals instead of 5, @charset "UTF-8" with literal characters instead of escapes in content, unquoted attribute selector values, hex instead of rgb(), and one @media block per rule instead of merged blocks.

Use of AI Tools

AI assistance: Yes
Tools: Claude Code
Model: Claude Opus 5.5
Used for: Applying the changes, backporting the PR, regenerating the lockfile, building and testing on Node.js 14 and 24 and comparing the output, and drafting this description.

sirreal and others added 9 commits November 12, 2026 12:07
Matches trunk's .nvmrc. Node.js 24.20 bundles npm 11.19.
LibSass (node-sass 4.14.1) has no Node.js 24 binary and does not compile against Node.js 24. node-sass becomes an alias of sass 1.32.8, the version WordPress 5.2 builds its own styles with. bin/packages/build.js keeps calling renderSync().

Dart Sass reads an imported .css file as plain CSS, so the react-dates stylesheet, which calls darken(), fails to compile. An importer passes that file to Sass as SCSS, as LibSass read it.
deasync builds its binding with the node-gyp in node_modules/.bin. Lerna's npm-lifecycle installs node-gyp 3.8.0 there, which needs Python 2. node-gyp 12.4.0 is the version npm 11.19 bundles, and builds deasync on Node.js 24 with Python 3.
npm 11 prepares git dependencies that have a build script by installing their devDependencies and running the build. webpack-rtl-plugin's build fails there, because its `babel` devDependency is the Babel 6 no-op package. The tarball of the same commit, fc5a2f2, installs the committed lib/ without preparing it, as npm 6 did.
webpack 4 hashes with md4, which OpenSSL 3 disables. `wp-scripts build` and `wp-scripts start` start webpack in a new process, which does not receive the flag, so the scripts run webpack's binary with node directly. Jest runs the webpack plugin tests in the same process.
npm 11 converts the npm 6 lockfile to lockfileVersion 3, which the Static Analysis job's `npm install` would otherwise do on every run. `legacy-peer-deps = true` makes npm 11 resolve peer dependencies as npm 6 did; without it, `npm ci` rejects the lockfile because ajv-keywords asks for a peer ajv 6 while the hoisted ajv is 5.5.2.

Versions change only where the previous commits require it: sass 1.32.8 replaces node-sass 4.14.1 and its dependencies, and node-gyp 12.4.0 replaces 3.8.0, which moves graceful-fs from 4.1.11 and 4.1.15 to 4.2.11 and nopt, abbrev and tar to node-gyp 12's versions. No runtime dependency changes.
…k-rtl-plugin (wp/5.2)

Removes webpack-rtl-plugin and the 117 dependency paths only it used. No other path, version, resolved URL or integrity changes.
@sirreal sirreal added the [Type] Build Tooling Issues or PRs related to build tooling label Nov 16, 2026
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

This branch has not been deployed

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

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants