managarten/apps/matrix/apps/mobile/eas-build-pre-install.sh
Till JS 402e135179 fix(matrix-mobile): add EAS Build pre-install hook for pnpm hoisted mode
pnpm's strict isolated dependency resolution prevents @babel/core from
finding babel-preset-expo and @babel/plugin-transform-react-jsx during
Metro bundling. The pre-install hook creates .npmrc with node-linker=hoisted
at the monorepo root so pnpm uses a flat node_modules on EAS Build.

Also simplified metro.config.js by removing manual monorepo watchFolders
config (handled automatically by expo/metro-config since SDK 52).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:08:52 +01:00

13 lines
468 B
Bash
Executable file

#!/bin/bash
# EAS Build pre-install hook
# Creates .npmrc with node-linker=hoisted at the monorepo root
# so pnpm uses a flat node_modules structure compatible with
# React Native / Metro bundler module resolution.
MONOREPO_ROOT="$EAS_BUILD_WORKINGDIR"
if [ -z "$MONOREPO_ROOT" ]; then
MONOREPO_ROOT=$(cd "$(dirname "$0")/../../../.." && pwd)
fi
echo "node-linker=hoisted" > "$MONOREPO_ROOT/.npmrc"
echo "Created .npmrc with node-linker=hoisted at $MONOREPO_ROOT"