@jxsuite/compiler 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/cli.js +46 -47
- package/package.json +1 -1
- package/src/site/site-build.ts +14 -6
package/package.json
CHANGED
package/src/site/site-build.ts
CHANGED
|
@@ -2246,17 +2246,25 @@ function injectComponentScripts(
|
|
|
2246
2246
|
.map((href) => `<link rel="modulepreload" href="${href}">`)
|
|
2247
2247
|
.join("\n ");
|
|
2248
2248
|
|
|
2249
|
-
|
|
2249
|
+
/*
|
|
2250
|
+
* The import map goes in <head>, AHEAD of the hints. The HTML spec rejects an import map that
|
|
2251
|
+
* arrives after a module load or preload has started, and Firefox enforces it: with the map at
|
|
2252
|
+
* the end of <body>, the `modulepreload` links above had already started, so the map was
|
|
2253
|
+
* dropped ("Import maps are not allowed after a module load or preload has started") and every
|
|
2254
|
+
* component module died on `@vue/reactivity` being a bare specifier nothing remapped. That took
|
|
2255
|
+
* down the theme toggle, site search and every interactive component, in Firefox only.
|
|
2256
|
+
*
|
|
2257
|
+
* A map already present (islands, a page template) is already in <head> and is left where it is;
|
|
2258
|
+
* the hints are inserted at `</head>`, behind it.
|
|
2259
|
+
*/
|
|
2260
|
+
const hasImportMap = html.includes('<script type="importmap">');
|
|
2261
|
+
const result = intoHead([hasImportMap ? "" : importMap, preloads, styleBlock]);
|
|
2250
2262
|
|
|
2251
2263
|
const moduleScripts = jsTags
|
|
2252
2264
|
.map((tag: string) => `<script type="module" src="/components/${tag}.js"></script>`)
|
|
2253
2265
|
.join("\n ");
|
|
2254
2266
|
|
|
2255
|
-
|
|
2256
|
-
const hasImportMap = result.includes('<script type="importmap">');
|
|
2257
|
-
const injection = (hasImportMap ? "" : `${importMap}\n `) + moduleScripts;
|
|
2258
|
-
|
|
2259
|
-
return result.replace("</body>", ` ${injection}\n</body>`);
|
|
2267
|
+
return result.replace("</body>", ` ${moduleScripts}\n</body>`);
|
|
2260
2268
|
}
|
|
2261
2269
|
|
|
2262
2270
|
/**
|