Skip to content

Commit af0214d

Browse files
committed
Add fallback for watchFolders in the metro config
1 parent ba65a41 commit af0214d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

apps/test-app/metro.config.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { makeMetroConfig } = require("@rnx-kit/metro-config");
2-
module.exports = makeMetroConfig({
2+
3+
const config = makeMetroConfig({
34
transformer: {
45
getTransformOptions: async () => ({
56
transform: {
@@ -9,3 +10,15 @@ module.exports = makeMetroConfig({
910
}),
1011
},
1112
});
13+
14+
if (config.watchFolders.length === 0) {
15+
// This patch is needed to locate packages in the monorepo from the MacOS app
16+
// which is intentionally kept outside of the workspaces configuration to prevent
17+
// duplicate react-native version and pollution of the package lock.
18+
const path = require("node:path");
19+
config.watchFolders.push(
20+
path.resolve(__dirname, "../.."),
21+
);
22+
}
23+
24+
module.exports = config;

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export default tseslint.config(
6868
},
6969
{
7070
files: [
71+
"**/metro.config.js",
7172
"packages/gyp-to-cmake/bin/*.js",
7273
"packages/host/bin/*.mjs",
7374
"packages/host/scripts/*.mjs",

0 commit comments

Comments
 (0)