Skip to content

Commit 941bb16

Browse files
sapphi-redbluwy
andauthored
refactor(legacy)!: remove ignoreBrowserslistConfig option (#14429)
Co-authored-by: Bjorn Lu <[email protected]>
1 parent 995c4b6 commit 941bb16

File tree

3 files changed

+6
-28
lines changed

3 files changed

+6
-28
lines changed

packages/plugin-legacy/README.md

+2-12
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ npm add -D terser
4444

4545
The query is also [Browserslist compatible](https://github.com/browserslist/browserslist). See [Browserslist Best Practices](https://github.com/browserslist/browserslist#best-practices) for more details.
4646

47+
If it's not set, plugin-legacy will load [the browserslist config sources](https://github.com/browserslist/browserslist#queries) and then fallback to the default value.
48+
4749
### `polyfills`
4850

4951
- **Type:** `boolean | string[]`
@@ -63,18 +65,6 @@ npm add -D terser
6365

6466
Note: if additional polyfills are needed for both the modern and legacy chunks, they can simply be imported in the application source code.
6567

66-
### `ignoreBrowserslistConfig`
67-
68-
- **Type:** `boolean`
69-
- **Default:** `false`
70-
71-
`@babel/preset-env` automatically detects [`browserslist` config sources](https://github.com/browserslist/browserslist#browserslist-):
72-
73-
- `browserslist` field in `package.json`
74-
- `.browserslistrc` file in cwd.
75-
76-
Set to `true` to ignore these sources.
77-
7868
### `modernPolyfills`
7969

8070
- **Type:** `boolean | string[]`

packages/plugin-legacy/src/index.ts

+4-12
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
461461
],
462462
[
463463
(await import('@babel/preset-env')).default,
464-
createBabelPresetEnvOptions(targets, {
465-
needPolyfills,
466-
ignoreBrowserslistConfig: options.ignoreBrowserslistConfig,
467-
}),
464+
createBabelPresetEnvOptions(targets, { needPolyfills }),
468465
],
469466
],
470467
})
@@ -641,9 +638,7 @@ export async function detectPolyfills(
641638
presets: [
642639
[
643640
(await import('@babel/preset-env')).default,
644-
createBabelPresetEnvOptions(targets, {
645-
ignoreBrowserslistConfig: true,
646-
}),
641+
createBabelPresetEnvOptions(targets, {}),
647642
],
648643
],
649644
})
@@ -662,10 +657,7 @@ export async function detectPolyfills(
662657

663658
function createBabelPresetEnvOptions(
664659
targets: any,
665-
{
666-
needPolyfills = true,
667-
ignoreBrowserslistConfig,
668-
}: { needPolyfills?: boolean; ignoreBrowserslistConfig?: boolean },
660+
{ needPolyfills = true }: { needPolyfills?: boolean },
669661
) {
670662
return {
671663
targets,
@@ -680,7 +672,7 @@ function createBabelPresetEnvOptions(
680672
}
681673
: undefined,
682674
shippedProposals: true,
683-
ignoreBrowserslistConfig,
675+
ignoreBrowserslistConfig: true,
684676
}
685677
}
686678

packages/plugin-legacy/src/types.ts

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ export interface Options {
33
* default: 'defaults'
44
*/
55
targets?: string | string[] | { [key: string]: string }
6-
/**
7-
* default: false
8-
*/
9-
ignoreBrowserslistConfig?: boolean
106
/**
117
* default: true
128
*/

0 commit comments

Comments
 (0)