diff --git a/package.json b/package.json index 50b64f5124956e..907405ddea2d4d 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@microsoft/api-extractor": "^7.34.4", "@rollup/plugin-typescript": "^11.1.0", "@types/babel__core": "^7.20.0", + "@types/babel__preset-env": "^7.9.2", "@types/babel__standalone": "^7.1.4", "@types/convert-source-map": "^2.0.0", "@types/cross-spawn": "^6.0.2", diff --git a/packages/plugin-legacy/src/index.ts b/packages/plugin-legacy/src/index.ts index 29dfb4f754a128..b9e3be2a852802 100644 --- a/packages/plugin-legacy/src/index.ts +++ b/packages/plugin-legacy/src/index.ts @@ -438,7 +438,7 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] { }), ], [ - '@babel/preset-env', + (await import('@babel/preset-env')).default, createBabelPresetEnvOptions(targets, { needPolyfills, ignoreBrowserslistConfig: options.ignoreBrowserslistConfig, @@ -608,7 +608,7 @@ export async function detectPolyfills( configFile: false, presets: [ [ - '@babel/preset-env', + (await import('@babel/preset-env')).default, createBabelPresetEnvOptions(targets, { ignoreBrowserslistConfig: true, }), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6540cd1371fa07..b99df8351a3038 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ importers: '@types/babel__core': specifier: ^7.20.0 version: 7.20.0 + '@types/babel__preset-env': + specifier: ^7.9.2 + version: 7.9.2 '@types/babel__standalone': specifier: ^7.1.4 version: 7.1.4 @@ -3566,6 +3569,10 @@ packages: '@babel/types': 7.21.4 dev: true + /@types/babel__preset-env@7.9.2: + resolution: {integrity: sha512-epEgKQiqTDZdPgYwtriYK1GVAGcyVZVvvw2UatX3+95mogKGimebApcMEWLF12uhUbNIvX284CSQEavnV/OIgw==} + dev: true + /@types/babel__standalone@7.1.4: resolution: {integrity: sha512-HijIDmcNl3Wmo0guqjYkQvMzyRCM6zMCkYcdG8f+2X7mPBNa9ikSeaQlWs2Yg18KN1klOJzyupX5BPOf+7ahaw==} dependencies: