let hasCheckedModules = false ; module . exports = function ( api ) { const isWeb = api . caller ( ( caller ? ) => caller && ( caller . name === 'babel-loader' || caller . name === 'next-babel-turbo-loader' ) ) ; if ( ! hasCheckedModules ) { hasCheckedModules = true ; const missingPackages = [ isWeb && 'next/babel' , 'babel-preset-expo' ] . filter ( packageName => packageName && ! hasModule ( packageName ) ) ; if ( missingPackages . length ) throw new Error ( `[BABEL]: preset \`@expo/next-adapter/babel\` is missing peer dependencies: ${ missingPackages . join ( ', ' ) }` ) ; } return { presets : [ isWeb && require ( 'next/babel' ) , [ require ( 'babel-preset-expo' ) , { web : { useTransformReactJsxExperimental : true } , 'no-anonymous-default-export' : false } , ] , ] . filter ( Boolean ) } ; } ; function hasModule ( name ) { try { return ! ! require . resolve ( name ) ; } catch ( error ) { if ( error . code === 'MODULE_NOT_FOUND' && error . message . includes ( name ) ) { return false ; } throw error ; } }