diff --git a/packages/plugin-legacy/README.md b/packages/plugin-legacy/README.md index 37700afae156e3..0e40ccfe55f121 100644 --- a/packages/plugin-legacy/README.md +++ b/packages/plugin-legacy/README.md @@ -44,6 +44,8 @@ npm add -D terser 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. + 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. + ### `polyfills` - **Type:** `boolean | string[]` @@ -63,18 +65,6 @@ npm add -D terser Note: if additional polyfills are needed for both the modern and legacy chunks, they can simply be imported in the application source code. -### `ignoreBrowserslistConfig` - -- **Type:** `boolean` -- **Default:** `false` - - `@babel/preset-env` automatically detects [`browserslist` config sources](https://github.com/browserslist/browserslist#browserslist-): - - - `browserslist` field in `package.json` - - `.browserslistrc` file in cwd. - - Set to `true` to ignore these sources. - ### `modernPolyfills` - **Type:** `boolean | string[]` diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index eb5dbb0752756f..fe9c89284d429e 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -454,10 +454,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { ], [ (await import('@babel/preset-env')).default, - createBabelPresetEnvOptions(targets, { - needPolyfills, - ignoreBrowserslistConfig: options.ignoreBrowserslistConfig, - }), + createBabelPresetEnvOptions(targets, { needPolyfills }), ], ], }) @@ -633,9 +630,7 @@ export async function detectPolyfills( presets: [ [ (await import('@babel/preset-env')).default, - createBabelPresetEnvOptions(targets, { - ignoreBrowserslistConfig: true, - }), + createBabelPresetEnvOptions(targets, {}), ], ], }) @@ -654,10 +649,7 @@ export async function detectPolyfills( function createBabelPresetEnvOptions( targets: any, - { - needPolyfills = true, - ignoreBrowserslistConfig, - }: { needPolyfills?: boolean; ignoreBrowserslistConfig?: boolean }, + { needPolyfills = true }: { needPolyfills?: boolean }, ) { return { targets, @@ -672,7 +664,7 @@ function createBabelPresetEnvOptions( } : undefined, shippedProposals: true, - ignoreBrowserslistConfig, + ignoreBrowserslistConfig: true, } } diff --git a/packages/plugin-legacy/src/types.ts b/packages/plugin-legacy/src/types.ts index 0731d7936d91f8..954617d900d241 100644 --- a/packages/plugin-legacy/src/types.ts +++ b/packages/plugin-legacy/src/types.ts @@ -3,10 +3,6 @@ export interface Options { * default: 'defaults' */ targets?: string | string[] | { [key: string]: string } - /** - * default: false - */ - ignoreBrowserslistConfig?: boolean /** * default: true */