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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9bd58a46c4
commit
527d417ab4
23
desktop/patches/metro+0.58.0.patch
Normal file
23
desktop/patches/metro+0.58.0.patch
Normal file
@@ -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."
|
||||
+ );
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user