Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

feat: use process.env.METRO_NODE_OPTIONS when starting Metro #2401

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/xdl/src/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1796,9 +1796,12 @@ export async function startReactNativeServerAsync(

if (options.reset) {
cliOpts.push('--reset-cache');
} // Get custom CLI path from project package.json, but fall back to node_module path
}

// Get custom CLI path from project package.json, but fall back to node_module path
const defaultCliPath = resolveModule('react-native/local-cli/cli.js', projectRoot, exp);
const cliPath = exp.rnCliPath || defaultCliPath;

let nodePath;
// When using a custom path for the RN CLI, we want it to use the project
// root to look up config files and Node modules
Expand All @@ -1807,6 +1810,7 @@ export async function startReactNativeServerAsync(
} else {
nodePath = null;
}

// Run the copy of Node that's embedded in Electron by setting the
// ELECTRON_RUN_AS_NODE environment variable
// Note: the CLI script sets up graceful-fs and sets ulimit to 4096 in the
Expand All @@ -1816,6 +1820,7 @@ export async function startReactNativeServerAsync(
cwd: projectRoot,
env: {
...process.env,
NODE_OPTIONS: process.env.METRO_NODE_OPTIONS,
REACT_NATIVE_APP_ROOT: projectRoot,
ELECTRON_RUN_AS_NODE: '1',
...nodePathEnv,
Expand Down