Skip to content

Commit

Permalink
fix: use nonce attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-tay committed Oct 31, 2023
1 parent 64ac967 commit c219633
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export function updateStyle(id: string, content: string): void {
if (cspNonce === undefined) {
cspNonce =
document.querySelector<HTMLMetaElement>('meta[property=csp-nonce]')
?.content ?? null
?.nonce ?? null
}
if (cspNonce) {
style.setAttribute('nonce', cspNonce)
Expand Down
2 changes: 1 addition & 1 deletion playground/css/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<meta property="csp-nonce" content="random" />
<meta property="csp-nonce" nonce="random" />

<link rel="stylesheet" href="./linked.css" />

Expand Down

0 comments on commit c219633

Please sign in to comment.