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

Conversation

aleclarson
Copy link
Contributor

Instead of using NODE_OPTIONS from the expo-cli process, the Metro process overrides it with METRO_NODE_OPTIONS.

This has two effects:

  • the Metro process can be debugged with --inspect-brk
  • the expo-cli process can be debugged with --inspect-brk without causing an "address already in use" error in the Metro process

Fixes expo/expo#9398

Instead of using NODE_OPTIONS from the expo-cli process, the Metro process overrides it with METRO_NODE_OPTIONS.

This has two effects: (1) the expo-cli process can be debugged with --inspect-brk without causing an "address already in use" error in the Metro process,
and (2) the Metro process can be debugged with --inspect-brk.
Copy link
Member

@brentvatne brentvatne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@fson - this ok with you?

Copy link
Contributor

@fson fson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, seems good to me. 👍

Tip: as an alternative way to make debugging Metro easier, you can also use the new EXPO_USE_DEV_SERVER=true environment variable, which makes Metro run in the same process instead of a subprocess. (This feature is currently in beta, but we'll make it the default soon.)

@brentvatne brentvatne merged commit 261e20c into expo:master Sep 24, 2020
@omulet
Copy link

omulet commented Oct 5, 2020

The problem is now that the configured NODE_OPTIONS gets discarded completely. So if I previously used NODE_OPTIONS=--max_old_space_size=4096 expo publish, now I must use METRO_NODE_OPTIONS=--max_old_space_size=.... Not a big issue unless you rely on NODE_OPTIONS in multiple CI workflows.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debugging the Metro server by running it "in band"
4 participants