Summary: Patch for "metro" to avoid erasing of "process" global var during bundling. Also removed "process" babel transform for main Electron process which was also made to workaround the same issue with "process" being erased. Reviewed By: mweststrate Differential Revision: D22389153 fbshipit-source-id: 569882e20534eedfca45509b8efe0186d335c681
30 lines
1.3 KiB
Diff
30 lines
1.3 KiB
Diff
diff --git a/node_modules/metro/src/lib/getPreludeCode.js b/node_modules/metro/src/lib/getPreludeCode.js
|
|
index 57e008e..b645266 100644
|
|
--- a/node_modules/metro/src/lib/getPreludeCode.js
|
|
+++ b/node_modules/metro/src/lib/getPreludeCode.js
|
|
@@ -42,7 +42,7 @@ function getPreludeCode(_ref) {
|
|
"__BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now()",
|
|
`__DEV__=${String(isDev)}`
|
|
].concat(_toConsumableArray(formatExtraVars(extraVars)), [
|
|
- "process=this.process||{}"
|
|
+ "process=process||this.process||global.process||{}"
|
|
]);
|
|
return `var ${vars.join(",")};${processEnv(
|
|
isDev ? "development" : "production"
|
|
diff --git a/node_modules/metro/src/lib/polyfills/require.js b/node_modules/metro/src/lib/polyfills/require.js
|
|
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,6 @@ 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."
|
|
- );
|
|
}
|
|
}
|
|
|