From 89de3d4ae29392f9ed79e5d922c69e03ce1125cd Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Wed, 3 Jun 2020 08:42:39 -0700 Subject: [PATCH] Disable require cycle warnings Summary: The holier-than-thou warnings of metro about require cycles are annoying. Require cycles are generally speaking well handles by ESM, and cause only harm if modules themselves are stateful, which is a bad smell. But warning for every cycle is just a flooding of false positives and removes the insentive to drop actual warnings. Reviewed By: jknoxville Differential Revision: D21859908 fbshipit-source-id: 66ec9a619a3737ccab5b16d11be5623d1d97c9f6 --- desktop/patches/metro+0.59.0.patch | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/desktop/patches/metro+0.59.0.patch b/desktop/patches/metro+0.59.0.patch index 4e33928a0..c4862d1d6 100644 --- a/desktop/patches/metro+0.59.0.patch +++ b/desktop/patches/metro+0.59.0.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/metro/src/lib/polyfills/require.js b/node_modules/metro/src/lib/polyfills/require.js -index 8c04756..3610bba 100644 +index 8c04756..d773811 100644 --- a/node_modules/metro/src/lib/polyfills/require.js +++ b/node_modules/metro/src/lib/polyfills/require.js -@@ -114,11 +114,13 @@ function metroRequire(moduleId) { +@@ -114,11 +114,6 @@ function metroRequire(moduleId) { .map(id => (modules[id] ? modules[id].verboseName : "[unknown]")); // We want to show A -> B -> A: cycle.push(cycle[0]); @@ -11,13 +11,6 @@ index 8c04756..3610bba 100644 - "Require cycles are allowed, but can result in uninitialized values. " + - "Consider refactoring to remove the need for a cycle." - ); -+ if (!cycle.every(path => path.includes('/node_modules/'))) { -+ console.warn( -+ `Require cycle: ${cycle.join(" -> ")}\n\n` + -+ "Require cycles are allowed, but can result in uninitialized values. " + -+ "Consider refactoring to remove the need for a cycle." -+ ); -+ } } }