From 527d417ab4fe6c3d2900ed204d7bb3dad74f7ce9 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Fri, 3 Apr 2020 04:04:00 -0700 Subject: [PATCH] Suppress Metro warning about cyclic dependencies in node_modules Summary: Metro shows cyclic dependencies warnings in dev mode even if they are caused by 3rd party packages installed into node_modules. This produces a lot of noise, but totally unactionable. In this diff I have implemented patch for "metro" package wich disables these unactionable warnings. Reviewed By: passy Differential Revision: D20835057 fbshipit-source-id: 2aebc59a0f8c0adfc768ed4c170e5d0b9ced7e0e --- desktop/patches/metro+0.58.0.patch | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 desktop/patches/metro+0.58.0.patch diff --git a/desktop/patches/metro+0.58.0.patch b/desktop/patches/metro+0.58.0.patch new file mode 100644 index 000000000..845531dbe --- /dev/null +++ b/desktop/patches/metro+0.58.0.patch @@ -0,0 +1,23 @@ +diff --git a/node_modules/metro/src/lib/polyfills/require.js b/node_modules/metro/src/lib/polyfills/require.js +index 8c04756..56c0d34 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) { + .map(id => (modules[id] ? modules[id].verboseName : "[unknown]")); // We want to show A -> B -> A: + + cycle.push(cycle[0]); +- 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." +- ); ++ if (!cycle[0].startsWith('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." ++ ); ++ } + } + } +