From b0967dd2c587135e236bc06b04b522dbc47cb1fa Mon Sep 17 00:00:00 2001 From: byGalax Date: Fri, 15 May 2026 00:34:14 +0200 Subject: [PATCH] fix(mobile): switch to shamefully-hoist=true for RN flat node_modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selective public-hoist patterns weren't enough — RN's index.js imports invariant (and nullthrows, pretty-format, regenerator-runtime, and many more) as bare transitive deps. Each fresh EAS build was hitting a different missing-module error. shamefully-hoist=true is Expo's official monorepo workaround: pnpm mirrors npm/yarn's flat layout at the workspace root, so every package's deps are reachable via standard Node resolution. Desktop (Vite-bundled) is unaffected. --- .npmrc | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.npmrc b/.npmrc index 132e737..4807da9 100644 --- a/.npmrc +++ b/.npmrc @@ -1,16 +1,11 @@ # React Native / Expo expects a flat (npm/yarn-style) node_modules layout -# where transitive deps are reachable from any package. pnpm's strict -# isolation breaks that — Metro can't resolve @babel/runtime/helpers/*, -# @expo/metro-runtime, react-native-* peers, etc. when they're only -# installed for the package that declared them. +# where ALL transitive deps are reachable from any package. pnpm's strict +# isolation breaks that — Metro hits a fresh missing-module error for every +# transitive dep (invariant, nullthrows, @babel/runtime/helpers/*, ...). # -# These patterns hoist the common RN/Expo dependency families to the -# workspace root node_modules so Metro and the Expo bundler can find -# them via the standard Node resolution algorithm. -public-hoist-pattern[]=*@babel/runtime* -public-hoist-pattern[]=@expo/* -public-hoist-pattern[]=expo -public-hoist-pattern[]=expo-* -public-hoist-pattern[]=*react-native* -public-hoist-pattern[]=@react-native* -public-hoist-pattern[]=*metro* +# shamefully-hoist=true hoists everything to the workspace-root node_modules +# (like npm/yarn) so all transitive deps are reachable via standard Node +# resolution. This is the official Expo monorepo workaround and is the +# only sustainable answer for Expo + RN + pnpm. Desktop (Electron+Vite) +# bundles via Vite, so the flatter layout doesn't affect it. +shamefully-hoist=true