-
Notifications
You must be signed in to change notification settings - Fork 114
/
metro.config.js
42 lines (35 loc) · 1.27 KB
/
metro.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
const path = require("path");
// Find the project and workspace directories
const projectRoot = __dirname;
// This can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(projectRoot, "../..");
const config = getDefaultConfig(__dirname, {
isCSSEnabled: true,
});
config.resolver.sourceExts.push("css");
config.watcher = {
// +73.3
...config.watcher,
healthCheck: {
enabled: true,
},
};
// 1. Watch all files within the monorepo
config.watchFolders = [workspaceRoot];
// 2. Let Metro know where to resolve packages and in what order
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, "node_modules"),
path.resolve(workspaceRoot, "node_modules"),
];
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
config.resolver.disableHierarchicalLookup = true;
const { FileStore } = require("metro-cache");
config.cacheStores = [
// Ensure the cache isn't shared between projects
// this ensures the transform-time environment variables are changed to reflect
// the current project.
new FileStore({ root: path.join(projectRoot, "node_modules/.cache/metro") }),
];
module.exports = config;