Expo Workspaces - Unable to resolve module

Please provide the following:

  1. SDK Version: 42.0.3
  2. Platforms(Android/iOS/web/all): Android and iOS

Summary

Hello!

I have been moving a React Native project, within a monorepo, over to a managed Expo workflow. However, I am having quite a lot of difficulty configuring the various bundlers to behave appropriately in a Yarn 2 Workspaces environment. I have gotten Expo web (react-native-web via WebPack) to bundle and work as expected.

Unfortunately, I’m seeing some weird errors when bundling via Metro for iOS or Android. In particular, the module resolution seems to be ignoring assets (trying to import as source or directory barrel file) and also not finding source-files which are in fact there (can be resolved in-editor via TypeScript).

I’ve taken quite a bit of time to extract the monorepo structure and create a reproducible demo of the problem here: GitHub - Braden1996/monorepo-template: A moderately opinionated monorepo template for launching an Expo mobile app and Next website w/ shared code and storybook powered design systems.

My hope is, once this is solved, this can serve as quite a nice template for the community.

Environment

Expo CLI 4.11.0 environment info:
System:
OS: macOS 11.5.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.4 - /var/folders/gg/1bvc0mtd34qf25qnwxcwvbyh0000gn/T/fnm_multishells/2553_1630156392755/bin/node
Yarn: 3.0.0 - /opt/homebrew/bin/yarn
npm: 6.14.14 - /var/folders/gg/1bvc0mtd34qf25qnwxcwvbyh0000gn/T/fnm_multishells/2553_1630156392755/bin/npm
Watchman: 2021.08.02.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.10.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 28, 29, 31
Build Tools: 29.0.2, 31.0.0
System Images: android-31 | Google APIs ARM 64 v8a
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
npmPackages:
expo: ~42.0.3 => 42.0.3
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2
react-native-web: ^0.17.1 => 0.17.1
npmGlobalPackages:
expo-cli: 4.11.0
Expo Workflow: managed

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.