Gallery: its dev manifest fallback names the tree from the build config, not a literal

The one tree path compiled into any bundle. Built today it is byte-identical (sha 3d5467fd…);
built with the config renamed it reads /public/<new name>/manifest.json.
This commit is contained in:
doxa-maps-88655c70 2026-09-25 15:52:20 +00:00
parent f3ab830909
commit 9792bc9162
2 changed files with 9 additions and 2 deletions

View file

@ -1132,7 +1132,9 @@ export default defineComponent({
let crossOrigin = false
try { crossOrigin = new URL(rootUrl, location.href).origin !== location.origin } catch { /* relative = same */ }
const candidates = crossOrigin ? [copy, root] : [root, copy]
const devFallback = '/public/doxa-maps/manifest.json'
// 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) })
const tried = []
const attempt = (i) => {

View file

@ -99,7 +99,12 @@ export default defineConfig(({ command, mode }) => {
// the maintainer's internal platform and must NOT exist in public
// artifacts. Default FALSE strips it from every bundle (dead-branch +
// treeshake); an explicitly-flagged platform build sets DOXA_QA=1.
define: { __DOXA_QA__: JSON.stringify(process.env.DOXA_QA === '1') },
define: {
__DOXA_QA__: JSON.stringify(process.env.DOXA_QA === '1'),
// The output tree's name (vite.doxa-maps-build-config.json `name`, the same value OUT_ROOT uses),
// for the few runtime paths that must name the tree — so renaming the tree needs no source edit.
__DOXA_TREE_NAME__: JSON.stringify(MFE_NAME),
},
// Build only: shadow-DOM CSS is injected from useShadowStyles(`…`) literals that
// ship verbatim, so their block comments are stripped before the Vue compiler
// runs (enforce: 'pre'). Dev keeps the comments.