From 8ea1b88ba27e1f33f58ff96cebba4135eeceb979 Mon Sep 17 00:00:00 2001 From: jiadesen Date: Wed, 22 Nov 2023 14:35:10 +0800 Subject: [PATCH 1/2] fix(plugin-legacy): syntax error in variable `detectModernBrowserCode` --- packages/plugin-legacy/src/snippets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-legacy/src/snippets.ts b/packages/plugin-legacy/src/snippets.ts index c0b49d7ae2b95d..032fdaa469637c 100644 --- a/packages/plugin-legacy/src/snippets.ts +++ b/packages/plugin-legacy/src/snippets.ts @@ -8,7 +8,7 @@ export const systemJSInlineCode = `System.import(document.getElementById('${lega const detectModernBrowserVarName = '__vite_is_modern_browser' export const detectModernBrowserDetector = `import.meta.url;import("_").catch(()=>1);(async function*(){})().next()` -export const detectModernBrowserCode = `${detectModernBrowserDetector}if(location.protocol!="file:"){window.${detectModernBrowserVarName}=true}` +export const detectModernBrowserCode = `${detectModernBrowserDetector};if(location.protocol!="file:"){window.${detectModernBrowserVarName}=true}` export const dynamicFallbackInlineCode = `!function(){if(window.${detectModernBrowserVarName})return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("${legacyPolyfillId}"),n=document.createElement("script");n.src=e.src,n.onload=function(){${systemJSInlineCode}},document.body.appendChild(n)}();` export const modernChunkLegacyGuard = `export function __vite_legacy_guard(){${detectModernBrowserDetector}};` From 96a3b8b6bb5ade1078a3306d0772b508b45a098d Mon Sep 17 00:00:00 2001 From: jiadesen Date: Wed, 22 Nov 2023 15:10:58 +0800 Subject: [PATCH 2/2] docs(plugin-legacy): outdated csp hash --- packages/plugin-legacy/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-legacy/README.md b/packages/plugin-legacy/README.md index 5ca8fd1a4f4126..27f6f22e803be8 100644 --- a/packages/plugin-legacy/README.md +++ b/packages/plugin-legacy/README.md @@ -164,7 +164,7 @@ The current values are: - `sha256-MS6/3FCg4WjP9gwgaBGwLpRCY6fZBgwmhVCdrPrNf3E=` - `sha256-tQjf8gvb2ROOMapIxFvFAYBeUJ0v1HCbOcSmDNXGtDo=` -- `sha256-6gxDO54HJkJNWi7H6ipFpWWSkWSRpyuZYMGDyG6bcNE=` +- `sha256-VA8O2hAdooB288EpSTrGLl7z3QikbWU9wwoebO/QaYk=` - `sha256-+5XkZFazzJo8n0iOP4ti/cLCMUudTf//Mzkb7xNPXIc=`