From 8f05b9bfa5bc82212bbe644af91080c4da53a049 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Wed, 8 Apr 2026 14:17:38 -0700 Subject: [PATCH] Force [hash] in Bun chunk naming so older Bun versions don't collide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cloudflare Pages ships an older Bun than the one used locally. That version emits shared CSS chunks via the default 'chunk-[hash]' naming template, but the [hash] token isn't always populated when the chunk is shared across multiple HTML entrypoints — every sub-page that imports sub-pages.css ends up wanting the same './chunk-' filename and the build aborts with 'Multiple files share the same output path'. Pin the chunk and asset naming explicitly so [hash] is always present regardless of Bun version. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/build.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/build.js b/scripts/build.js index bc3505e4d..fd2a00861 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -298,6 +298,16 @@ async function buildStaticSite(extraEntrypoints = []) { outdir: outdir, minify: true, sourcemap: 'linked', + // Older Bun versions (e.g. the one Cloudflare Pages ships) emit shared + // CSS/JS chunks without a content hash in the filename, which collides + // when multiple HTML entries import the same CSS partial. Force the + // chunk + asset naming to always include [hash] so the build is + // reproducible across Bun versions. + naming: { + entry: '[dir]/[name].[ext]', + chunk: '[name]-[hash].[ext]', + asset: '[name]-[hash].[ext]', + }, }); if (!result.success) {