@marko/vite 5.1.3 → 5.1.4
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/dist/index.mjs +8 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -651,16 +651,18 @@ function renderAssets(slot) {
|
|
|
651
651
|
// To avoid FOUC we will hide the page until all of these modules are loaded.
|
|
652
652
|
const { preload } = entry;
|
|
653
653
|
if (preload) {
|
|
654
|
-
html += \`<script
|
|
654
|
+
html += \`<script marko-vite-preload async blocking=render type=module\${this.___viteInjectAttrs}>\`;
|
|
655
|
+
html+= "await Promise.allSettled([";
|
|
656
|
+
|
|
655
657
|
for (const id of preload) {
|
|
656
|
-
html += \`import
|
|
658
|
+
html += \`import(\${JSON.stringify(base + id)}),\`;
|
|
657
659
|
}
|
|
658
660
|
|
|
659
|
-
html += "
|
|
661
|
+
html += "]);";
|
|
660
662
|
html += "document.documentElement.style.visibility='';";
|
|
661
|
-
html +=
|
|
662
|
-
|
|
663
|
-
html += \`</script><script
|
|
663
|
+
html += "if(document.documentElement.getAttribute('style')==='')document.documentElement.removeAttribute('style');";
|
|
664
|
+
html += "document.querySelectorAll('[marko-vite-preload]').forEach((el) => el.remove());";
|
|
665
|
+
html += \`</script><script marko-vite-preload\${this.___viteInjectAttrs}>document.documentElement.style.visibility='hidden'</script>\`;
|
|
664
666
|
}
|
|
665
667
|
}`}
|
|
666
668
|
|