Skip to content

Commit 2b97093

Browse files
authored
chore(native): update metro config for nativewind (#572)
1 parent 97af79b commit 2b97093

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

apps/cli/templates/frontend/native/nativewind/metro.config.js

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,16 @@ const { withNativeWind } = require("nativewind/metro");
55
const path = require("node:path");
66

77
const config = withTurborepoManagedCache(
8-
withMonorepoPaths(
9-
withNativeWind(getDefaultConfig(__dirname), {
10-
input: "./global.css",
11-
configPath: "./tailwind.config.js",
12-
}),
13-
),
8+
withNativeWind(getDefaultConfig(__dirname), {
9+
input: "./global.css",
10+
configPath: "./tailwind.config.js",
11+
}),
1412
);
1513

1614
config.resolver.unstable_enablePackageExports = true;
1715

18-
config.resolver.disableHierarchicalLookup = true;
19-
2016
module.exports = config;
2117

22-
/**
23-
* Add the monorepo paths to the Metro config.
24-
* This allows Metro to resolve modules from the monorepo.
25-
*
26-
* @see https://docs.expo.dev/guides/monorepos/#modify-the-metro-config
27-
* @param {import('expo/metro-config').MetroConfig} config
28-
* @returns {import('expo/metro-config').MetroConfig}
29-
*/
30-
function withMonorepoPaths(config) {
31-
const projectRoot = __dirname;
32-
const workspaceRoot = path.resolve(projectRoot, "../..");
33-
34-
// #1 - Watch all files in the monorepo
35-
config.watchFolders = [workspaceRoot];
36-
37-
// #2 - Resolve modules within the project's `node_modules` first, then all monorepo modules
38-
config.resolver.nodeModulesPaths = [
39-
path.resolve(projectRoot, "node_modules"),
40-
path.resolve(workspaceRoot, "node_modules"),
41-
];
42-
43-
return config;
44-
}
45-
4618
/**
4719
* Move the Metro cache to the `.cache/metro` folder.
4820
* If you have any environment variables, you can configure Turborepo to invalidate it when needed.

0 commit comments

Comments
 (0)