Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,21 @@ function polyfillsPlugin(
(excludeSystemJS ? '' : `import "systemjs/dist/s.min.js";`)
)
}
},
renderChunk(_, __, opts) {
// systemjs includes code that can't be minified down to es5 by esbuild
if (!excludeSystemJS) {
// @ts-ignore avoid esbuild transform on legacy chunks since it produces
// legacy-unsafe code - e.g. rewriting object properties into shorthands
opts.__vite_skip_esbuild__ = true

// @ts-ignore force terser for legacy chunks. This only takes effect if
// minification isn't disabled, because that leaves out the terser plugin
// entirely.
opts.__vite_force_terser__ = true
}

return null
}
}
}
Expand Down