From aee58b74ead641002525ecacd015b4f6858ad41a Mon Sep 17 00:00:00 2001 From: Yunfei He Date: Sun, 1 Mar 2026 16:16:44 +0800 Subject: [PATCH] fix: skip CSS files when packaging worker modules for deploy Vite's SSR build extracts CSS files into the worker output directory, but these are only needed on the client side. Including them in the worker upload causes Cloudflare to reject the deploy with a SyntaxError when it tries to parse CSS as JavaScript. Co-Authored-By: Claude Opus 4.6 --- packages/void/src/cli/package.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/void/src/cli/package.ts b/packages/void/src/cli/package.ts index 33b6c1ea6..ff0a4329d 100644 --- a/packages/void/src/cli/package.ts +++ b/packages/void/src/cli/package.ts @@ -112,6 +112,10 @@ export function packageBuild( if (relativePath === "wrangler.json") continue; // Skip .vite/ build metadata (manifest.json etc.) — not runtime code if (relativePath.startsWith(".vite/") || relativePath.startsWith(".vite\\")) continue; + // Skip CSS files — Vite extracts them during SSR build but they're only + // needed on the client side. Uploading them as worker modules causes + // Cloudflare to reject the deploy (SyntaxError parsing CSS as JS). + if (relativePath.endsWith(".css")) continue; const content = readFileSync(filePath); formData.append(`worker:${relativePath}`, new Blob([content]), relativePath); } @@ -222,6 +226,7 @@ export function packageFrameworkBuild(opts: { const relativePath = relative(opts.workerDir, filePath); if (relativePath === "wrangler.json" || relativePath === "wrangler.jsonc") continue; if (relativePath.startsWith(".vite/") || relativePath.startsWith(".vite\\")) continue; + if (relativePath.endsWith(".css")) continue; const content = readFileSync(filePath); formData.append(`worker:${relativePath}`, new Blob([content]), relativePath); }