xref: /expo/apps/router-e2e/metro.config.js (revision 8e07b095)
1const { createMetroConfiguration } = require('expo-yarn-workspaces');
2const { FileStore } = require('metro-cache');
3
4// Find the project and workspace directories
5const projectRoot = __dirname;
6
7/** @type {import('expo/metro-config').MetroConfig} */
8const config = createMetroConfiguration(projectRoot);
9
10const path = require('path');
11
12const root = path.join(projectRoot, '../..');
13
14config.watchFolders = [projectRoot, ...['packages', 'node_modules'].map((v) => path.join(root, v))];
15
16config.resolver.blockList = [
17  ...config.resolver.blockList,
18
19  /node_modules\/@react-navigation\/native-stack\/node_modules\/@react-navigation\//,
20  /packages\/expo-router\/node_modules\/@react-navigation/,
21  /node_modules\/pretty-format\/node_modules\/react-is/,
22];
23
24config.cacheStores = [
25  // Ensure the cache isn't shared between projects
26  // this ensures the transform-time environment variables are changed to reflect
27  // the current project.
28  new FileStore({
29    root: path.join(
30      projectRoot,
31      'node_modules/.cache/metro',
32      process.env.E2E_ROUTER_SRC || 'app',
33      // TODO: Move app.json to serializer instead of babel plugin.
34      process.env.EXPO_E2E_BASE_PATH || '/'
35    ),
36  }),
37];
38
39module.exports = config;
40