Merge Posterverse's dev manifest fallback (shareable pages P2 assembly)
This commit is contained in:
commit
49b0fff62b
1 changed files with 4 additions and 2 deletions
|
|
@ -281,7 +281,9 @@ export default defineComponent({
|
|||
// 2. <tree>/doxa-maps-spa/manifest.json, the byte-identical copy generate-tree writes for the
|
||||
// Research Gallery. The live static layer sends CORS headers only inside a tree folder, not
|
||||
// on the root manifest, so a partner page's script embed reads this copy FIRST;
|
||||
// 3. /public/<tree>/manifest.json, where the dev server keeps the built manifest.
|
||||
// 3. /<tree>/manifest.json, the built tree as the dev server serves it (at the ROOT). NOT /public/<tree>/:
|
||||
// the dev server treats a /public/… request as SOURCE and injects an import into each built IIFE, which
|
||||
// then fails as a classic script ("Cannot use import statement outside a module").
|
||||
// Script URLs always resolve against the tree ROOT, never the copy's folder.
|
||||
loadManifest() {
|
||||
const dirOf = (u) => { try { return new URL(u, location.href).href.replace(/[^/]*$/, '') } catch { return '' } }
|
||||
|
|
@ -291,7 +293,7 @@ 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_TREE_NAME__ + '/manifest.json'
|
||||
const devFallback = '/' + __DOXA_TREE_NAME__ + '/manifest.json'
|
||||
if (!candidates.some((c) => c.url === devFallback)) candidates.push({ url: devFallback, root: dirOf(devFallback) })
|
||||
const tried = []
|
||||
const attempt = (i) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue