xref: /expo/apps/router-e2e/metro.config.js (revision 6eefacaa)
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  isCSSEnabled: true,
10});
11
12const path = require('path');
13
14const root = path.join(projectRoot, '../..');
15
16config.watchFolders = [projectRoot, ...['packages', 'node_modules'].map((v) => path.join(root, v))];
17
18config.resolver.blockList = [
19  ...config.resolver.blockList,
20
21  /node_modules\/@react-navigation\/native-stack\/node_modules\/@react-navigation\//,
22  /packages\/expo-router\/node_modules\/@react-navigation/,
23  /node_modules\/pretty-format\/node_modules\/react-is/,
24];
25
26config.cacheStores = [
27  // Ensure the cache isn't shared between projects
28  // this ensures the transform-time environment variables are changed to reflect
29  // the current project.
30  new FileStore({
31    root: path.join(projectRoot, 'node_modules/.cache/metro', process.env.E2E_ROUTER_SRC || 'app'),
32  }),
33];
34
35module.exports = config;
36