Skip to content

Commit

Permalink
fix(legacy): don't force set build.target when `renderLegacyChunks=…
Browse files Browse the repository at this point in the history
…false` (fixes #10201) (#10220)
  • Loading branch information
sapphi-red committed Sep 23, 2022
1 parent 097fd57 commit 7f548e8
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/plugin-legacy/src/index.ts
Expand Up @@ -176,17 +176,19 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
config.build.cssTarget = 'chrome61'
}

// Vite's default target browsers are **not** the same.
// See https://github.com/vitejs/vite/pull/10052#issuecomment-1242076461
overriddenBuildTarget = config.build.target !== undefined
// browsers supporting ESM + dynamic import + import.meta
config.build.target = [
'es2020',
'edge79',
'firefox67',
'chrome64',
'safari11.1'
]
if (genLegacy) {
// Vite's default target browsers are **not** the same.
// See https://github.com/vitejs/vite/pull/10052#issuecomment-1242076461
overriddenBuildTarget = config.build.target !== undefined
// browsers supporting ESM + dynamic import + import.meta
config.build.target = [
'es2020',
'edge79',
'firefox67',
'chrome64',
'safari11.1'
]
}
}

return {
Expand Down

0 comments on commit 7f548e8

Please sign in to comment.