Skip to content

Commit

Permalink
fix: broken vite preload when used with cspnonce (#145)
Browse files Browse the repository at this point in the history
* fix: broken vite preload when used with cspnonce

* chore: add changeset
  • Loading branch information
vwong authored Jul 24, 2024
1 parent e64d2f5 commit 88655ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/silent-sheep-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/vite": patch
---

Fix issue in dev mode where Content Security Policies may prevent script from running
2 changes: 1 addition & 1 deletion src/render-assets-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function renderAssets(slot) {
html += "document.documentElement.style.visibility='';";
html +=
"if(document.documentElement.getAttribute('style')==='')document.documentElement.removeAttribute('style');";
html += "</script><script class=marko-vite-preload>document.documentElement.style.visibility='hidden'</script>";
html += \`</script><script class=marko-vite-preload\${this.___viteInjectAttrs}>document.documentElement.style.visibility='hidden'</script>\`;
}
}`
}
Expand Down

0 comments on commit 88655ce

Please sign in to comment.