Skip to content

Upgrade to Node 24 (minimal) - #470

Merged
johnemau merged 2 commits into
mainfrom
john-with-claude/preact-cli-support-454a21
Oct 8, 2026
Merged

johnemau merged 2 commits into
mainfrom
john-with-claude/preact-cli-support-454a21

Conversation

@johnemau

@johnemau johnemau commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes

  • Build: Can't resolve 'src/autoPlayMode'.
  • Tests: Cannot set property navigator of #<Object> which has only a getter.
  • Vercel: Node.js Version "20.x" is discontinued and must be upgraded.
View Before After
Demo page widget (identical) Before: live demo donation widget After: yarn dev donation widget

Follow-up

🤖 Generated with Claude Code

Problem: On Node 22+, `yarn build` fails with `Can't resolve 'src/autoPlayMode'`, and cloudflare-worker tests fail with `Cannot set property navigator of #<Object> which has only a getter`. Vercel no longer builds with Node 20.
Root cause: preact-cli 3.5.0 loads preact.config.js through the archived `esm` package, which throws on Node 22+; preact-cli catches the error and builds with its default config, dropping the `src/` path alias. Node 21+ defines a getter-only global `navigator`, so `Object.assign` cannot install the service-worker-mock globals.
Solution: Patch preact-cli to load the config with `require` (applied by a v4 postinstall through the existing patch-package) and export the config with `module.exports`. Delete the global `navigator` before assigning the mocks. Set `engines.node` to 24.x so Vercel builds with Node 24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
donate-button Ready Ready Preview Oct 8, 2026 7:13pm UTC

Request Review

@johnemau johnemau changed the title Fix preact-cli config loading and worker tests on Node 24 Upgrade to Node 24 Oct 8, 2026
@johnemau johnemau changed the title Upgrade to Node 24 Upgrade to Node 24 (minimal) Oct 8, 2026
@johnemau
johnemau marked this pull request as ready for review October 8, 2026 18:49
Copilot AI balanced review requested due to automatic review settings October 8, 2026 18:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

CI and local tooling still select Node 18 or 20, leaving the declared Node 24 runtime untested.

1 open finding
What changed in this PR

Adds minimal Node 24 compatibility while retaining the existing Preact CLI build.

Changes:

  • Patches Preact CLI’s incompatible ESM loader and converts its config to CommonJS.
  • Handles Node 21+’s getter-only navigator in worker tests.
  • Declares Node 24 as the required runtime.
File Description
package.json Declares Node 24 support.
packages/​donate-button-v4/​package.json Applies the Preact CLI patch after installation.
packages/​donate-button-v4/​preact.config.js Exports configuration as CommonJS.
packages/​donate-button-v4/​patches/​preact-cli+3.5.0.patch Replaces Preact CLI’s ESM loader with require.
packages/​cloudflare-worker/​test/​_setup.ts Removes Node’s getter-only navigator before mock setup.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread package.json
@johnemau johnemau self-assigned this Oct 8, 2026
@johnemau johnemau added the p1 label Oct 8, 2026
@johnemau
johnemau added this pull request to stack #472 October 8, 2026 19:05
CI installed Node 18.17.1 and .tool-versions selected Node 20.11.0, so neither exercised the Node 24 runtime declared in engines.node, where the esm config failure and the getter-only navigator occur.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johnemau
johnemau merged commit 6b87732 into main Oct 8, 2026
6 checks passed
@johnemau
johnemau deleted the john-with-claude/preact-cli-support-454a21 branch October 8, 2026 19:34

This branch was successfully deployed

1 active deployment
Preview — 4cc01f5c Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants