From 8b2c4a38a461ff5ecc95972291bc711e2c5dec9a Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Fri, 28 Apr 2023 01:47:57 +0800 Subject: --- .../apps/native/metro.config.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/with-react-native-web/apps/native/metro.config.js (limited to 'examples/with-react-native-web/apps/native/metro.config.js') diff --git a/examples/with-react-native-web/apps/native/metro.config.js b/examples/with-react-native-web/apps/native/metro.config.js new file mode 100644 index 0000000..21f6371 --- /dev/null +++ b/examples/with-react-native-web/apps/native/metro.config.js @@ -0,0 +1,21 @@ +// Learn more https://docs.expo.io/guides/customizing-metro +const { getDefaultConfig } = require("expo/metro-config"); +const path = require("path"); + +// Find the workspace root, this can be replaced with `find-yarn-workspace-root` +const workspaceRoot = path.resolve(__dirname, "../.."); +const projectRoot = __dirname; + +const config = getDefaultConfig(projectRoot); + +// 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; + +module.exports = config; -- cgit v1.2.3-70-g09d2