@marko/vite 4.1.13 → 4.1.14

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.
Files changed (2) hide show
  1. package/dist/index.mjs +6 -12
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -53,22 +53,16 @@ function renderAssets(slot) {
53
53
  // To avoid FOUC we will hide the page until all of these modules are loaded.
54
54
  const { preload } = entry;
55
55
  if (preload) {
56
- let sep = "";
57
- html += \`<script\${this.___viteInjectAttrs}>((root=document.documentElement)=>{\`;
58
- html += "root.style.visibility='hidden';";
59
- html += "document.currentScript.remove();";
60
- html += "Promise.allSettled([";
61
-
56
+ html += \`<script class=marko-vite-preload blocking=render type=module\${this.___viteInjectAttrs}>\`;
62
57
  for (const id of preload) {
63
- html += \`\${sep}import(\${JSON.stringify(base + id)})\`;
64
- sep = ",";
58
+ html += \`import \${JSON.stringify(base + id)};\`;
65
59
  }
66
60
 
67
- html += "]).then(()=>{";
68
- html += "root.style.visibility='';";
61
+ html += "document.querySelectorAll('.marko-vite-preload').forEach((el) => el.remove());";
62
+ html += "document.documentElement.style.visibility='';";
69
63
  html +=
70
- "if(root.getAttribute('style')==='')root.removeAttribute('style')";
71
- html += "})})()</script>";
64
+ "if(document.documentElement.getAttribute('style')==='')document.documentElement.removeAttribute('style');";
65
+ html += "</script><script class=marko-vite-preload>document.documentElement.style.visibility='hidden'</script>";
72
66
  }
73
67
  }`}
74
68
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
3
  "description": "A Marko plugin for Vite",
4
- "version": "4.1.13",
4
+ "version": "4.1.14",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {