From 52a704f7c7ae0da23c40e3ecb7487f19e1a345db Mon Sep 17 00:00:00 2001 From: veillettem Date: Tue, 17 Nov 2026 02:10:46 -0500 Subject: [PATCH 1/2] chore: sync vite.config.ts (single-file navigation denylist) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RTDmW21h73yh7C17mWHCSK --- vite.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index cbe3897..735c205 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -408,6 +408,9 @@ export default defineConfig(({ mode }) => { }, workbox: { maximumFileSizeToCacheInBytes: WORKBOX_MAX_FILE_BYTES, + // Lets /-single.html (the build:single file Baton's deploy.yml adds + // after this build) reach returning visitors instead of the fallback index.html. + navigateFallbackDenylist: [/-single\.html$/], globPatterns: [ `**/*.{${["js", "css", "html", "svg", "png", "woff2", ...simConfig.precacheExtensions].join(",")}}`, ], From 0fe71f294f2f06846107043f1243bbdd94fd926f Mon Sep 17 00:00:00 2001 From: veillettem Date: Tue, 17 Nov 2026 02:28:03 -0500 Subject: [PATCH 2/2] fix(single): fill the __VITE_PRELOAD__ placeholder in the inlined chunk With codeSplitting off Vite leaves the dynamic-import deps placeholder unreplaced, so the first lazy import() throws a ReferenceError in the build:single file (ColliderLab, MolScope). Replace it with void 0; the preload helper skips preloading when deps is undefined. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RTDmW21h73yh7C17mWHCSK --- vite.config.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 735c205..069893d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -187,8 +187,12 @@ function inlineAsset(html: string, fileName: string, item: Rolldown.OutputChunk if (!scriptTag.test(html)) { return null; } + // With codeSplitting off, Vite never fills the `__VITE_PRELOAD__` deps placeholder + // it puts in each dynamic `import()` wrapper, so the first lazy import throws a + // ReferenceError (ColliderLab, MolScope). One chunk has nothing to preload, and the + // helper skips preloading when its deps argument is undefined. // Escape `` so an inlined occurrence cannot close the tag early. - const code = item.code.replace(/<\/script>/g, "<\\/script>"); + const code = item.code.replaceAll("__VITE_PRELOAD__", "void 0").replace(/<\/script>/g, "<\\/script>"); return html.replace(scriptTag, () => ``); }