From 1aaf4d6c9f682098e191e53e28cfa5a4b163f7d7 Mon Sep 17 00:00:00 2001 From: thebanjomatic Date: Sat, 13 Apr 2024 08:26:27 -0600 Subject: [PATCH 1/2] feat: write cspNonce to style tags --- packages/vite/src/node/plugins/html.ts | 1 + playground/csp/index.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/plugins/html.ts b/packages/vite/src/node/plugins/html.ts index f5acc47a39d8ab..7d971375040b5c 100644 --- a/packages/vite/src/node/plugins/html.ts +++ b/packages/vite/src/node/plugins/html.ts @@ -1184,6 +1184,7 @@ export function injectNonceAttributeTagHook( if ( nodeName === 'script' || + nodeName === 'style' || (nodeName === 'link' && attrs.some( (attr) => diff --git a/playground/csp/index.html b/playground/csp/index.html index c29d55054921d6..45a508e76a2cd3 100644 --- a/playground/csp/index.html +++ b/playground/csp/index.html @@ -1,5 +1,5 @@ -