From b1a8e5856db91df264a7d1e40bf847dde5eb0981 Mon Sep 17 00:00:00 2001 From: Niko Ni Date: Thu, 19 Jan 2023 01:07:14 +0800 Subject: [PATCH] refactor(plugin-legacy): optimize cspHashes array (#11734) --- packages/plugin-legacy/src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index 3e8b86eee48888..9068935bed118b 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -797,10 +797,10 @@ function wrapIIFEBabelPlugin(): BabelPlugin { } export const cspHashes = [ - createHash('sha256').update(safari10NoModuleFix).digest('base64'), - createHash('sha256').update(systemJSInlineCode).digest('base64'), - createHash('sha256').update(detectModernBrowserCode).digest('base64'), - createHash('sha256').update(dynamicFallbackInlineCode).digest('base64'), -] + safari10NoModuleFix, + systemJSInlineCode, + detectModernBrowserCode, + dynamicFallbackInlineCode, +].map((i) => createHash('sha256').update(i).digest('base64')) export default viteLegacyPlugin