We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5a18284 commit ac16abdCopy full SHA for ac16abd
packages/plugin-legacy/src/index.ts
@@ -710,6 +710,21 @@ function polyfillsPlugin(
710
(excludeSystemJS ? '' : `import "systemjs/dist/s.min.js";`)
711
)
712
}
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
728
729
730
0 commit comments