@@ -217,7 +217,7 @@ function shouldIgnoreBabelrc(filename, babelrc) {
217217async function getEnvConfig ( asset , isSourceModule ) {
218218 // Load the target engines for the app and generate a babel-preset-env config
219219 let targetEngines = await getTargetEngines ( asset , true ) ;
220- let targetEnv = await getEnvPlugins ( targetEngines ) ;
220+ let targetEnv = await getEnvPlugins ( targetEngines , true ) ;
221221 if ( ! targetEnv ) {
222222 return null ;
223223 }
@@ -226,7 +226,7 @@ async function getEnvConfig(asset, isSourceModule) {
226226 // Otherwise, load the source engines and generate a babel-present-env config.
227227 if ( asset . name . includes ( NODE_MODULES ) && ! isSourceModule ) {
228228 let sourceEngines = await getTargetEngines ( asset , false ) ;
229- let sourceEnv = ( await getEnvPlugins ( sourceEngines ) ) || targetEnv ;
229+ let sourceEnv = ( await getEnvPlugins ( sourceEngines , false ) ) || targetEnv ;
230230
231231 // Do a diff of the returned plugins. We only need to process the remaining plugins to get to the app target.
232232 let sourcePlugins = new Set ( sourceEnv . map ( p => p [ 0 ] ) ) ;
@@ -240,7 +240,7 @@ async function getEnvConfig(asset, isSourceModule) {
240240
241241const envCache = new Map ( ) ;
242242
243- async function getEnvPlugins ( targets ) {
243+ async function getEnvPlugins ( targets , useBuiltIns = false ) {
244244 if ( ! targets ) {
245245 return null ;
246246 }
@@ -250,7 +250,10 @@ async function getEnvPlugins(targets) {
250250 return envCache . get ( key ) ;
251251 }
252252
253- let plugins = presetEnv . default ( { } , { targets, modules : false } ) . plugins ;
253+ let plugins = presetEnv . default (
254+ { } ,
255+ { targets, modules : false , useBuiltIns : useBuiltIns ? 'entry' : false }
256+ ) . plugins ;
254257 envCache . set ( key , plugins ) ;
255258 return plugins ;
256259}
0 commit comments