Skip to content

Commit

Permalink
fix(legacy): skip esbuild transform for systemjs (#9635)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Aug 11, 2022
1 parent 5a18284 commit ac16abd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/plugin-legacy/src/index.ts
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

0 comments on commit ac16abd

Please sign in to comment.