Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting this error when starting a react native app for iphone

iOS Bundling failed 523ms error: node_modules/expo-router/_ctx.ios.tsx: node_modules/expo-router/_ctx.ios.tsx:Invalid call at line 6: // @ts-expect-error process.env.EXPO_ROUTER_IMPORT_MODE_IOS Fourth argument of require.context should be an optional string "mode" denoting how the modules will be resolved.

like image 261
Siddhant Mishra Avatar asked Jul 17 '26 23:07

Siddhant Mishra


2 Answers

If you're on expo SDK 50 and using expo-router v3 you should NOT include expo-router/babel in babel.config. If you're using tamagui with expo router v3 both on SDK 50 you should remove the transform-inline-environment-variables from babel.config as its messing with the EXPO_ROUTER_APP_ROOT ENV.

Other workarround is to manually set the APP_ROOT var on top of your babel.config with process.env.EXPO_ROUTER_APP_ROOT = '../../src/app';

reference:

  • https://github.com/expo/router/issues/41

  • https://github.com/tamagui/tamagui/issues/2044

like image 156
Pedro Bueno Avatar answered Jul 19 '26 15:07

Pedro Bueno


Managed to resolve this issue by adding expo-router/babel to plugins in the project babel config. I also needed to make a new EAS dev client build.

like image 34
nix Avatar answered Jul 19 '26 14:07

nix