Skip to content

Commit

Permalink
remove withMonorepoPaths
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Nov 23, 2024
1 parent bc634de commit 507fa5f
Showing 1 changed file with 5 additions and 31 deletions.
36 changes: 5 additions & 31 deletions apps/expo/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ const { getDefaultConfig } = require("expo/metro-config");
const { FileStore } = require("metro-cache");
const { withNativeWind } = require("nativewind/metro");

const path = require("path");
const path = require("node:path");

const config = withTurborepoManagedCache(
withMonorepoPaths(
withNativeWind(getDefaultConfig(__dirname), {
input: "./src/styles.css",
configPath: "./tailwind.config.ts",
}),
),
withNativeWind(getDefaultConfig(__dirname), {
input: "./src/styles.css",
configPath: "./tailwind.config.ts",
}),
);

// XXX: Resolve our exports in workspace packages
Expand All @@ -20,30 +18,6 @@ config.resolver.unstable_enablePackageExports = 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.
Expand Down

0 comments on commit 507fa5f

Please sign in to comment.