Skip to content

Commit

Permalink
fix(plugin-legacy): throw error when using esbuild minify with legacy…
Browse files Browse the repository at this point in the history
… plugin
  • Loading branch information
yyx990803 committed Jan 19, 2021
1 parent 5cb02ce commit 8fb2511
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/plugin-legacy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ function viteLegacyPlugin(options = {}) {
name: 'legacy-generate-polyfill-chunk',
apply: 'build',

configResolved(config) {
if (config.build.minify === 'esbuild') {
throw new Error(
`Can't use esbuild as the minifier when targeting legacy browsers ` +
`because esbuild minification is not legacy safe.`
)
}
},

async generateBundle(opts, bundle) {
if (!isLegacyOutput(opts)) {
if (!modernPolyfills.size) {
Expand Down

0 comments on commit 8fb2511

Please sign in to comment.