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
Bug report
Description
The
withClerkIOSconfig plugin fails to findClerkViewFactory.swiftwhen the Expo app is nested 2+ levels deep in a pnpm workspace (e.g.apps/mobile/).possiblePathsonly checks one level upIn
app.plugin.js, thepossiblePathsarray resolves paths relative toconfig.modRequest.projectRoot:./node_modules/@clerk/expo/ios/ClerkViewFactory.swift../node_modules/@clerk/expo/ios/ClerkViewFactory.swift../packages/expo/ios/ClerkViewFactory.swiftIn a standard pnpm workspace monorepo like:
The package lives at
../../node_modules/@clerk/expo/relative toprojectRoot, which none of thepossiblePathsentries cover.Suggested fix
Replace the hardcoded paths with
require.resolveto let Node's module resolution handle arbitrary nesting:Or, if you want to keep the
possiblePathsapproach, walk up the directory tree instead of checking only one level:Workaround
We're using
pnpm patch @clerk/expoto add the../../node_modules/path manually.Environment
@clerk/expo: 3.1.2apps/mobile/