import { getBareExtensions } from '@expo/config/paths' ; import { withUnimodules } from '@expo/webpack-config/addons' ; import { AnyConfiguration } from '@expo/webpack-config/webpack/types' ; export default function withExpo ( nextConfig = { } ) { return { ... nextConfig , pageExtensions : getBareExtensions ( [ 'web' ] ) , webpack ( config , options ) { process . env . EXPO_WEBPACK_DEFINE_ENVIRONMENT_AS_KEYS = 'true' ; const webpack5 = ( options . config || { } ) . webpack5 ; const expoConfig = withUnimodules ( config , { projectRoot : nextConfig . projectRoot || process . cwd ( ) } , { supportsFontLoading : false , webpack5 : webpack5 && webpack5 !== false } ) ; ( expoConfig . output || { } ) . publicPath = ( config . output || { } ) . publicPath ; if ( typeof nextConfig . webpack === 'function' ) { return nextConfig . webpack ( expoConfig , options ) ; } return expoConfig ; } } ; }