xref: /expo/apps/router-e2e/metro.config.js (revision e9783df2)
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(
32      projectRoot,
33      'node_modules/.cache/metro',
34      process.env.E2E_ROUTER_SRC || 'app',
35      // TODO: Move app.json to serializer instead of babel plugin.
36      process.env.EXPO_E2E_BASE_PATH || '/'
37    ),
38  }),
39];
40
41module.exports = config;
42