Skip to content

Commit ac16abd

Browse files
authored
fix(legacy): skip esbuild transform for systemjs (#9635)
1 parent 5a18284 commit ac16abd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/plugin-legacy/src/index.ts

+15
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,21 @@ function polyfillsPlugin(
710710
(excludeSystemJS ? '' : `import "systemjs/dist/s.min.js";`)
711711
)
712712
}
713+
},
714+
renderChunk(_, __, opts) {
715+
// systemjs includes code that can't be minified down to es5 by esbuild
716+
if (!excludeSystemJS) {
717+
// @ts-ignore avoid esbuild transform on legacy chunks since it produces
718+
// legacy-unsafe code - e.g. rewriting object properties into shorthands
719+
opts.__vite_skip_esbuild__ = true
720+
721+
// @ts-ignore force terser for legacy chunks. This only takes effect if
722+
// minification isn't disabled, because that leaves out the terser plugin
723+
// entirely.
724+
opts.__vite_force_terser__ = true
725+
}
726+
727+
return null
713728
}
714729
}
715730
}

0 commit comments

Comments
 (0)