From 9a3e6503f34c170e1860001434a5abac047fb92f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=A0=C4=87eki=C4=87?= Date: Wed, 5 Aug 2026 17:52:40 +0200 Subject: [PATCH 1/2] fix(mobile): keep colocated tests out of the Metro bundle Expo Router's require.context matches every .tsx under src/app. A colocated *.test.tsx registered as a route and pulled vitest, and therefore vite, into the bundle. Metro cannot transform vite's dynamic import, so export:embed failed. Block *.test.* under apps/mobile/src in the Metro resolver. --- apps/mobile/metro.config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/mobile/metro.config.js b/apps/mobile/metro.config.js index 960576859c..a5c2683652 100644 --- a/apps/mobile/metro.config.js +++ b/apps/mobile/metro.config.js @@ -17,6 +17,14 @@ config.resolver.nodeModulesPaths = [ path.resolve(monorepoRoot, 'node_modules'), ]; +// Keep colocated tests out of the app bundle. Expo Router's require.context matches +// every `.tsx` under `src/app`, so a `*.test.tsx` next to a route registers as a route +// and drags vitest (and vite) into the bundle, which Metro cannot transform. +config.resolver.blockList = [ + ...config.resolver.blockList, + /[\\/]apps[\\/]mobile[\\/]src[\\/].*\.test\.[jt]sx?$/, +]; + // Drop the unused Material Symbols font chain from the bundle. // // `expo-router`'s statically pulls `expo-symbols` (via withLayoutContext -> From 02612f6c659bdac26558df5201ca6bc4fd43d15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=A0=C4=87eki=C4=87?= Date: Wed, 5 Aug 2026 18:00:27 +0200 Subject: [PATCH 2/2] Update apps/mobile/metro.config.js Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com> --- apps/mobile/metro.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/mobile/metro.config.js b/apps/mobile/metro.config.js index a5c2683652..e7602115a6 100644 --- a/apps/mobile/metro.config.js +++ b/apps/mobile/metro.config.js @@ -21,7 +21,7 @@ config.resolver.nodeModulesPaths = [ // every `.tsx` under `src/app`, so a `*.test.tsx` next to a route registers as a route // and drags vitest (and vite) into the bundle, which Metro cannot transform. config.resolver.blockList = [ - ...config.resolver.blockList, + ...(config.resolver.blockList || []), /[\\/]apps[\\/]mobile[\\/]src[\\/].*\.test\.[jt]sx?$/, ];