Skip to content

Commit 8fb2511

Browse files
committed
fix(plugin-legacy): throw error when using esbuild minify with legacy plugin
1 parent 5cb02ce commit 8fb2511

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/plugin-legacy/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ function viteLegacyPlugin(options = {}) {
6969
name: 'legacy-generate-polyfill-chunk',
7070
apply: 'build',
7171

72+
configResolved(config) {
73+
if (config.build.minify === 'esbuild') {
74+
throw new Error(
75+
`Can't use esbuild as the minifier when targeting legacy browsers ` +
76+
`because esbuild minification is not legacy safe.`
77+
)
78+
}
79+
},
80+
7281
async generateBundle(opts, bundle) {
7382
if (!isLegacyOutput(opts)) {
7483
if (!modernPolyfills.size) {

0 commit comments

Comments
 (0)