Skip to content

Commit eb47b1e

Browse files
Mencisapphi-red
andauthored
fix(plugin-legacy): don't include SystemJS in modern polyfills (#6902)
Co-authored-by: sapphi-red <[email protected]>
1 parent d1ba059 commit eb47b1e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/plugin-legacy/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
134134
config.build,
135135
'es',
136136
opts,
137-
options.externalSystemJS
137+
true
138138
)
139139
return
140140
}
@@ -566,7 +566,7 @@ async function buildPolyfillChunk(
566566
buildOptions: BuildOptions,
567567
format: 'iife' | 'es',
568568
rollupOutputOptions: NormalizedOutputOptions,
569-
externalSystemJS?: boolean
569+
excludeSystemJS?: boolean
570570
) {
571571
let { minify, assetsDir } = buildOptions
572572
minify = minify ? 'terser' : false
@@ -575,7 +575,7 @@ async function buildPolyfillChunk(
575575
root: path.dirname(fileURLToPath(import.meta.url)),
576576
configFile: false,
577577
logLevel: 'error',
578-
plugins: [polyfillsPlugin(imports, externalSystemJS)],
578+
plugins: [polyfillsPlugin(imports, excludeSystemJS)],
579579
build: {
580580
write: false,
581581
target: false,
@@ -614,7 +614,7 @@ const polyfillId = '\0vite/legacy-polyfills'
614614

615615
function polyfillsPlugin(
616616
imports: Set<string>,
617-
externalSystemJS?: boolean
617+
excludeSystemJS?: boolean
618618
): Plugin {
619619
return {
620620
name: 'vite:legacy-polyfills',
@@ -627,7 +627,7 @@ function polyfillsPlugin(
627627
if (id === polyfillId) {
628628
return (
629629
[...imports].map((i) => `import "${i}";`).join('') +
630-
(externalSystemJS ? '' : `import "systemjs/dist/s.min.js";`)
630+
(excludeSystemJS ? '' : `import "systemjs/dist/s.min.js";`)
631631
)
632632
}
633633
}

0 commit comments

Comments
 (0)