From edbd280d4d3c25f3a0ad3793b854d042ad3a4d28 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Sat, 3 Oct 2026 07:19:22 +0000 Subject: [PATCH] Research Gallery dev fallback: the manifest at the public root first, so the dev server serves children as the raw build Reached as /public//, the dev server treats a built bundle as source and injects an import into its IIFE, so a child loaded as a classic script threw "Cannot use import statement outside a module" on the staging page. The root path is tried first; /public// stays last, for a plain static server. Built trees resolve the manifest before these fallbacks and are unaffected. --- plugin-designs/doxa-maps-spa/doxa-maps-spa.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugin-designs/doxa-maps-spa/doxa-maps-spa.vue b/plugin-designs/doxa-maps-spa/doxa-maps-spa.vue index 3c23fe887..2632b4426 100644 --- a/plugin-designs/doxa-maps-spa/doxa-maps-spa.vue +++ b/plugin-designs/doxa-maps-spa/doxa-maps-spa.vue @@ -1354,8 +1354,13 @@ export default defineComponent({ const candidates = crossOrigin ? [copy, root] : [root, copy] // The tree's name comes from the build config (vite define), never a literal here: this was the // one tree path compiled into any bundle, so a renamed tree would have needed a gallery edit. - const devFallback = '/public/' + __DOXA_TREE_NAME__ + '/manifest.json' - if (!candidates.some(c => c.url === devFallback)) candidates.push({ url: devFallback, root: dirOf(devFallback) }) + // ★ THE DEV SERVER SERVES public/ AT THE ROOT. Reached as /public//…, Vite treats a built bundle as SOURCE + // and injects an import into its IIFE, so a child loaded as a classic script throws "Cannot use import statement + // outside a module" (measured on the staging page, 2026-10-03). So the root path comes first, served as the raw + // build; /public// stays last, for a plain static server of the repository, which transforms nothing. + for (const devFallback of ['/' + __DOXA_TREE_NAME__ + '/manifest.json', '/public/' + __DOXA_TREE_NAME__ + '/manifest.json']) { + if (!candidates.some(c => c.url === devFallback)) candidates.push({ url: devFallback, root: dirOf(devFallback) }) + } const tried = [] // Every mount waits for this gate (see FRESH BUNDLES above): it opens once the manifest's bundles are known // to be current, when no manifest can be read (fail-soft, as before), or after 8 s whatever happens.