From 3c53fd4fe538027ad92a6d3193072ecf2c8486e0 Mon Sep 17 00:00:00 2001 From: poli0981 <127664709+poli0981@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:42:57 +0700 Subject: [PATCH] chore(node): move the toolchain to Node 26 - .node-version 22 -> 26 (CI, the release workflows and Workers Builds read it; Workers Builds also has NODE_VERSION=26 set) - package.json engines: node >=26 - vitest: run workers with --no-experimental-webstorage. Node 25+ defines a global `localStorage` that is undefined without --localstorage-file; zustand's persist only falls back to memory when reading the storage throws, so every store `set` crashed on undefined.setItem (39 tests in 4 files). Without Web Storage the stores fall back as they did on 22. Co-Authored-By: Claude Opus 5.5 --- .node-version | 2 +- package-lock.json | 3 +++ package.json | 3 +++ vitest.config.ts | 7 +++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.node-version b/.node-version index 2bd5a0a..6f4247a 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -22 +26 diff --git a/package-lock.json b/package-lock.json index 68eaa8c..57d4828 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,6 +55,9 @@ "vite": "^8.3.4", "vitest": "^4.1.11", "wrangler": "4.149.0" + }, + "engines": { + "node": ">=26" } }, "node_modules/@adobe/css-tools": { diff --git a/package.json b/package.json index ff8ac1f..f6a314f 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "private": true, "license": "Apache-2.0", "type": "module", + "engines": { + "node": ">=26" + }, "scripts": { "dev": "vite", "build": "tsc && vite build", diff --git a/vitest.config.ts b/vitest.config.ts index c2f1d97..0014c3e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -20,6 +20,13 @@ export default defineConfig({ }, test: { globals: true, + // Node 25+ defines a global `localStorage` that is `undefined` unless + // `--localstorage-file` is given. zustand's persist only falls back to + // memory when reading the storage *throws*, so every store `set` then + // crashes on `undefined.setItem`. Without Web Storage the global is gone + // and the stores fall back the way they always did on Node 22. The flag is + // accepted by Node 22 too. + execArgv: ["--no-experimental-webstorage"], // `.tsx` was absent until v0.35.0, so any component test written here // would have been collected by nobody and passed silently. Note that the // default environment is node — a test that renders needs an explicit