Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 0e14458

Browse files
Merging fcad7f6 into trunk-temp/pr-3928/835a350c-c231-4714-bc27-eb62ef88753d
2 parents d2aa7b7 + fcad7f6 commit 0e14458

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

‎apps/mobile/eas.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,27 @@
44
"appVersionSource": "remote"
55
},
66
"build": {
7+
"base": {
8+
"node": "22.19.0"
9+
},
710
"development": {
11+
"extends": "base",
812
"developmentClient": true,
913
"distribution": "internal"
1014
},
1115
"preview": {
16+
"extends": "base",
1217
"distribution": "internal"
1318
},
1419
"production": {
20+
"extends": "base",
1521
"autoIncrement": true,
1622
"android": {
1723
"buildType": "app-bundle"
1824
}
1925
},
2026
"play-registration": {
27+
"extends": "base",
2128
"distribution": "internal",
2229
"android": {
2330
"buildType": "apk"

‎apps/mobile/metro.config.js‎

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ config.resolver.nodeModulesPaths = [
1616
path.resolve(monorepoRoot, "node_modules"),
1717
];
1818

19-
// Force React to resolve from monorepo root, and alias workspace packages
20-
// directly to their TypeScript source so Babel can transpile them (Metro
21-
// does not consume the ESM `dist/` build cleanly).
19+
// Force React to resolve from monorepo root
2220
config.resolver.extraNodeModules = {
2321
react: path.resolve(monorepoRoot, "node_modules/react"),
24-
"@posthog/shared": path.resolve(monorepoRoot, "packages/shared/src/index.ts"),
2522
};
2623

2724
// Apply NativeWind first so its resolver/transformer changes are in place
@@ -42,4 +39,35 @@ nativeWindConfig.resolver = {
4239
sourceExts: [...nativeWindConfig.resolver.sourceExts, "svg"],
4340
};
4441

42+
// Resolve @posthog/shared to its TypeScript source so Babel transpiles it.
43+
// Its package.json `exports` point at `dist/`, which is only present after a
44+
// `pnpm build` -- EAS Build never runs one, so bundling there fails outright.
45+
// This must be a resolveRequest hook rather than an `extraNodeModules` alias:
46+
// pnpm symlinks the package into node_modules, so Metro resolves it there
47+
// first and never consults the alias, and an alias also cannot map subpath
48+
// imports like `@posthog/shared/domain-types`.
49+
const SHARED_PACKAGE = "@posthog/shared";
50+
const sharedSrc = path.resolve(monorepoRoot, "packages/shared/src");
51+
const upstreamResolveRequest = nativeWindConfig.resolver.resolveRequest;
52+
53+
nativeWindConfig.resolver.resolveRequest = (context, moduleName, platform) => {
54+
if (
55+
moduleName === SHARED_PACKAGE ||
56+
moduleName.startsWith(`${SHARED_PACKAGE}/`)
57+
) {
58+
const subpath = moduleName.slice(SHARED_PACKAGE.length + 1) || "index";
59+
return context.resolveRequest(
60+
context,
61+
path.join(sharedSrc, subpath),
62+
platform,
63+
);
64+
}
65+
66+
return (upstreamResolveRequest ?? context.resolveRequest)(
67+
context,
68+
moduleName,
69+
platform,
70+
);
71+
};
72+
4573
module.exports = nativeWindConfig;

0 commit comments

Comments
 (0)