Skip to content

Commit 8340bb5

Browse files
authored
fix(html): omit nonce on import map when cspNonce is unset (#22713)
1 parent df9e0a5 commit 8340bb5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/vite/src/node/plugins

packages/vite/src/node/plugins/html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ export function postImportMapHook(
12331233
const importMap = bundle![getImportMapFilename(config)] as OutputAsset
12341234
const importMapHtml = serializeTag({
12351235
tag: 'script',
1236-
attrs: { type: 'importmap', nonce },
1236+
attrs: { type: 'importmap', ...(nonce ? { nonce } : {}) },
12371237
children:
12381238
typeof importMap.source === 'string'
12391239
? importMap.source

0 commit comments

Comments
 (0)