Skip to content

Framework: Update Node.js to v24 (wp/5.3) - #86871

Draft
sirreal wants to merge 5 commits into
wp/5.3from
build/node-24-wp-5.3
Draft

sirreal wants to merge 5 commits into
wp/5.3from
build/node-24-wp-5.3

Conversation

@sirreal

@sirreal sirreal commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

What?

Sets .nvmrc to Node.js 24.20 on wp/5.3, 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.3 branch moves to Node.js 24 in WordPress/wordpress-develop#15694. 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.3 uses. bin/packages/build-worker.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. Removing node-sass also removes its node-gyp 3.8.0, which needs Python 2 and which deasync (from parcel-bundler) otherwise compiled with.
  • 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 --unhandled-rejections=warn, which is what wp-scripts test-unit-js ran. The webpack plugin test suites run webpack inside Jest, and packages/data/src/test/registry.js leaves a promise rejected, which ends its Jest worker on Node.js 15 and later. Node.js 14 only warned.
  • test-unit-php and test-unit-php-multisite set npm_package_wp_env_plugin_dir=gutenberg with cross-env. wp-scripts env test-php builds the PHPUnit config path from that variable, which npm 6 set from package.json's wp-env field and npm 7 and later no longer set, so PHPUnit looked in wp-content/plugins/undefined/.
  • .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. The only installed version change is sass 1.32.8 in place of node-sass 4.14.1, whose dependencies are removed. One nested entry that no package requires, @babel/helper-function-name 7.1.0 under postcss-jsx, is dropped.

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.3, 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(), grid-column values without spaces around /, 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, regenerating the lockfile, building and testing on Node.js 14 and 24 and comparing the output, and drafting this description.

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.3 builds its own styles with. bin/packages/build-worker.js keeps calling render().

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.
webpack 4 hashes with md4, which OpenSSL 3 disables, so webpack and the Jest tests that run webpack get --openssl-legacy-provider. `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 also gets --unhandled-rejections=warn, Node.js 14's behavior: packages/data/src/test/registry.js leaves a promise rejected, which otherwise ends its Jest worker on Node.js 15 and later.
npm 11 accepts the npm 6 lockfile in `npm ci`, but the Static Analysis job's `npm install` converts it to lockfileVersion 3, which fails the local changes check. `legacy-peer-deps = true` makes npm 11 resolve peer dependencies as npm 6 did.

The only version change is sass 1.32.8 replacing node-sass 4.14.1, which also removes node-sass's dependencies. No runtime dependency 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

`wp-scripts env test-php` builds the PHPUnit config path from npm_package_wp_env_plugin_dir, which npm 6 set from package.json's "wp-env" field. npm 7 and later no longer export arbitrary package.json fields, so on npm 11 the path is wp-content/plugins/undefined/. test-unit-php and test-unit-php-multisite set it to gutenberg, the "wp-env" "plugin-dir" value. test-php.js reads no other npm_package_wp_env_* variable.

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.

1 participant