Skip to content

Commit cb93534

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

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

apps/test-app/metro.config.js

Lines changed: 12 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,13 @@ 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(path.resolve(__dirname, "../.."));
20+
}
21+
22+
module.exports = config;

eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default tseslint.config(
4747
{
4848
files: [
4949
"apps/test-app/*.js",
50+
"apps/macos-test-app/*.js",
5051
"packages/node-addon-examples/**/*.js",
5152
"packages/host/babel-plugin.js",
5253
"packages/host/react-native.config.js",
@@ -68,6 +69,7 @@ export default tseslint.config(
6869
},
6970
{
7071
files: [
72+
"**/metro.config.js",
7173
"packages/gyp-to-cmake/bin/*.js",
7274
"packages/host/bin/*.mjs",
7375
"packages/host/scripts/*.mjs",

0 commit comments

Comments
 (0)