From e07a2ed6c2573dff12f86cb5c2fc9a59b3b4131c Mon Sep 17 00:00:00 2001 From: shulaoda <165626830+shulaoda@users.noreply.github.com> Date: Wed, 29 Jul 2026 03:41:25 +0800 Subject: [PATCH] fix: import node:path in the generated Node prerender runner --- packages/void/src/prerender.ts | 2 +- playground/node-static/package.json | 1 - playground/node-static/scripts/serve-static.mjs | 5 ++++- pnpm-lock.yaml | 3 --- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/void/src/prerender.ts b/packages/void/src/prerender.ts index 774490547..6f1c7e23e 100644 --- a/packages/void/src/prerender.ts +++ b/packages/void/src/prerender.ts @@ -452,7 +452,7 @@ async function runNodePrerenderRunner(root: string, config: NodeRunnerConfig) runnerPath, ` import { pathToFileURL } from "node:url"; -import { join, dirname } from "pathslash"; +import { dirname, join } from "node:path"; import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; const config = JSON.parse(process.argv[2]); diff --git a/playground/node-static/package.json b/playground/node-static/package.json index bc098995d..7c444b2e5 100644 --- a/playground/node-static/package.json +++ b/playground/node-static/package.json @@ -18,7 +18,6 @@ "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", "@void/react": "workspace:*", - "pathslash": "catalog:", "vite": "catalog:", "vite-plus": "catalog:", "void": "workspace:*" diff --git a/playground/node-static/scripts/serve-static.mjs b/playground/node-static/scripts/serve-static.mjs index a251ef900..d24b1d236 100644 --- a/playground/node-static/scripts/serve-static.mjs +++ b/playground/node-static/scripts/serve-static.mjs @@ -1,6 +1,9 @@ import { existsSync, readFileSync, statSync } from 'node:fs'; import { createServer } from 'node:http'; -import { extname, isAbsolute, relative, resolve } from 'pathslash'; +// Keep this playground free of `pathslash` so the build catches bare +// specifiers leaking into the generated prerender runner (#285). +// oxlint-disable-next-line no-restricted-imports +import { extname, isAbsolute, relative, resolve } from 'node:path'; const root = resolve(import.meta.dirname, '../dist/client'); const port = Number(process.env.PORT || 4179); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff167d485..19fa62a3e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -635,9 +635,6 @@ importers: '@void/react': specifier: workspace:* version: link:../../packages/react - pathslash: - specifier: 'catalog:' - version: 0.1.0 vite: specifier: npm:@voidzero-dev/vite-plus-core@0.2.2 version: '@voidzero-dev/vite-plus-core@0.2.2(@types/node@26.1.0)(esbuild@0.27.7)(jiti@2.7.0)(sass@1.99.0)(terser@5.48.0)(tsx@4.23.0)(typescript@6.0.3)(yaml@2.9.0)'