Skip to content

Commit 7f548e8

Browse files
authored
fix(legacy): don't force set build.target when renderLegacyChunks=false (fixes #10201) (#10220)
1 parent 097fd57 commit 7f548e8

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

packages/plugin-legacy/src/index.ts

+13-11
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,19 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
176176
config.build.cssTarget = 'chrome61'
177177
}
178178

179-
// Vite's default target browsers are **not** the same.
180-
// See https://github.com/vitejs/vite/pull/10052#issuecomment-1242076461
181-
overriddenBuildTarget = config.build.target !== undefined
182-
// browsers supporting ESM + dynamic import + import.meta
183-
config.build.target = [
184-
'es2020',
185-
'edge79',
186-
'firefox67',
187-
'chrome64',
188-
'safari11.1'
189-
]
179+
if (genLegacy) {
180+
// Vite's default target browsers are **not** the same.
181+
// See https://github.com/vitejs/vite/pull/10052#issuecomment-1242076461
182+
overriddenBuildTarget = config.build.target !== undefined
183+
// browsers supporting ESM + dynamic import + import.meta
184+
config.build.target = [
185+
'es2020',
186+
'edge79',
187+
'firefox67',
188+
'chrome64',
189+
'safari11.1'
190+
]
191+
}
190192
}
191193

192194
return {

0 commit comments

Comments
 (0)