From 2b97093a1d8f569c6684bc8d769abe081a6b6c8f Mon Sep 17 00:00:00 2001 From: Insik Han Date: Thu, 11 Sep 2025 12:59:23 +0900 Subject: [PATCH] chore(native): update metro config for nativewind (#572) --- .../native/nativewind/metro.config.js | 36 +++---------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/apps/cli/templates/frontend/native/nativewind/metro.config.js b/apps/cli/templates/frontend/native/nativewind/metro.config.js index 9107334..f52bbfa 100644 --- a/apps/cli/templates/frontend/native/nativewind/metro.config.js +++ b/apps/cli/templates/frontend/native/nativewind/metro.config.js @@ -5,44 +5,16 @@ const { withNativeWind } = require("nativewind/metro"); const path = require("node:path"); const config = withTurborepoManagedCache( - withMonorepoPaths( - withNativeWind(getDefaultConfig(__dirname), { - input: "./global.css", - configPath: "./tailwind.config.js", - }), - ), + withNativeWind(getDefaultConfig(__dirname), { + input: "./global.css", + configPath: "./tailwind.config.js", + }), ); config.resolver.unstable_enablePackageExports = true; -config.resolver.disableHierarchicalLookup = true; - module.exports = config; -/** - * Add the monorepo paths to the Metro config. - * This allows Metro to resolve modules from the monorepo. - * - * @see https://docs.expo.dev/guides/monorepos/#modify-the-metro-config - * @param {import('expo/metro-config').MetroConfig} config - * @returns {import('expo/metro-config').MetroConfig} - */ -function withMonorepoPaths(config) { - const projectRoot = __dirname; - const workspaceRoot = path.resolve(projectRoot, "../.."); - - // #1 - Watch all files in the monorepo - config.watchFolders = [workspaceRoot]; - - // #2 - Resolve modules within the project's `node_modules` first, then all monorepo modules - config.resolver.nodeModulesPaths = [ - path.resolve(projectRoot, "node_modules"), - path.resolve(workspaceRoot, "node_modules"), - ]; - - return config; -} - /** * Move the Metro cache to the `.cache/metro` folder. * If you have any environment variables, you can configure Turborepo to invalidate it when needed.