-
Notifications
You must be signed in to change notification settings - Fork 437
Open
Description
Bug report
Description
The withClerkIOS config plugin fails to find ClerkViewFactory.swift when the Expo app is nested 2+ levels deep in a pnpm workspace (e.g. apps/mobile/).
possiblePaths only checks one level up
In app.plugin.js, the possiblePaths array resolves paths relative to config.modRequest.projectRoot:
./node_modules/@clerk/expo/ios/ClerkViewFactory.swift../node_modules/@clerk/expo/ios/ClerkViewFactory.swift../packages/expo/ios/ClerkViewFactory.swift
In a standard pnpm workspace monorepo like:
monorepo/
├── node_modules/@clerk/expo/ ← package hoisted here
├── apps/
│ └── mobile/ ← projectRoot is here
├── pnpm-workspace.yaml
└── package.json
The package lives at ../../node_modules/@clerk/expo/ relative to projectRoot, which none of the possiblePaths entries cover.
Suggested fix
Replace the hardcoded paths with require.resolve to let Node's module resolution handle arbitrary nesting:
const swiftFile = require.resolve('@clerk/expo/ios/ClerkViewFactory.swift');Or, if you want to keep the possiblePaths approach, walk up the directory tree instead of checking only one level:
let dir = config.modRequest.projectRoot;
while (dir !== path.dirname(dir)) {
possiblePaths.push(
path.join(dir, 'node_modules', '@clerk', 'expo', 'ios', 'ClerkViewFactory.swift')
);
dir = path.dirname(dir);
}Workaround
We're using pnpm patch @clerk/expo to add the ../../node_modules/ path manually.
Environment
@clerk/expo: 3.1.2- pnpm workspaces with app at
apps/mobile/ - Expo SDK 55
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels