fix(mobile): switch to shamefully-hoist=true for RN flat node_modules
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.
This commit is contained in:
@@ -1,16 +1,11 @@
|
|||||||
# React Native / Expo expects a flat (npm/yarn-style) node_modules layout
|
# React Native / Expo expects a flat (npm/yarn-style) node_modules layout
|
||||||
# where transitive deps are reachable from any package. pnpm's strict
|
# where ALL transitive deps are reachable from any package. pnpm's strict
|
||||||
# isolation breaks that — Metro can't resolve @babel/runtime/helpers/*,
|
# isolation breaks that — Metro hits a fresh missing-module error for every
|
||||||
# @expo/metro-runtime, react-native-* peers, etc. when they're only
|
# transitive dep (invariant, nullthrows, @babel/runtime/helpers/*, ...).
|
||||||
# installed for the package that declared them.
|
|
||||||
#
|
#
|
||||||
# These patterns hoist the common RN/Expo dependency families to the
|
# shamefully-hoist=true hoists everything to the workspace-root node_modules
|
||||||
# workspace root node_modules so Metro and the Expo bundler can find
|
# (like npm/yarn) so all transitive deps are reachable via standard Node
|
||||||
# them via the standard Node resolution algorithm.
|
# resolution. This is the official Expo monorepo workaround and is the
|
||||||
public-hoist-pattern[]=*@babel/runtime*
|
# only sustainable answer for Expo + RN + pnpm. Desktop (Electron+Vite)
|
||||||
public-hoist-pattern[]=@expo/*
|
# bundles via Vite, so the flatter layout doesn't affect it.
|
||||||
public-hoist-pattern[]=expo
|
shamefully-hoist=true
|
||||||
public-hoist-pattern[]=expo-*
|
|
||||||
public-hoist-pattern[]=*react-native*
|
|
||||||
public-hoist-pattern[]=@react-native*
|
|
||||||
public-hoist-pattern[]=*metro*
|
|
||||||
|
|||||||
Reference in New Issue
Block a user