Skip to content

Commit

Permalink
Update packages/plugin-legacy/src/snippets.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Bjorn Lu <[email protected]>
  • Loading branch information
wmz46 and bluwy authored Apr 25, 2023
1 parent 68d0276 commit 23de288
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/plugin-legacy/src/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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* g(){};'
export const detectModernBrowserCode = `${detectModernBrowserDetector}if(window.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}};`

0 comments on commit 23de288

Please sign in to comment.