react / react/metro

react-native bundle never quits, metro-config implicated

Open
#638 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.6k
Forks
696
Avg merge
8m
Merged PRs (30d)
7

Description

I have a react-native monorepo which no longer builds bundles. I can run in development just fine, but when I try to build a bundle like so:

react-native bundle --platform ios --entry-file index.js --dev false --bundle-output ./ios/main.jsbundle --assets-dest ./ios --sourcemap-output ./sourcemap.js

It just hangs after this:

                    Welcome to Metro!
              Fast - Scalable - Integrated


info Writing bundle output to:, ./ios/main.jsbundle
info Writing sourcemap output to:, ./sourcemap.js
info Done writing bundle output
info Done writing sourcemap output
info Copying 118 asset files
info Done copying assets

When I use why-is-node-running, I see these handles:

# TTYWRAP
/app/node_modules/metro/node_modules/debug/src/node.js:68 - 2 === fd ? process.stderr :

# SIGNALWRAP
/app/node_modules/metro/node_modules/debug/src/node.js:68 - 2 === fd ? process.stderr :

# TTYWRAP
/app/node_modules/metro-config/src/defaults/index.js:187 - reporter: new TerminalReporter(new Terminal(process.stdout))
/app/node_modules/metro-config/src/defaults/index.js:198 - return getDefaultValues(rootPath);
/app/node_modules/metro-config/src/defaults/index.js:14  - var info = gen[key](arg);
/app/node_modules/metro-config/src/defaults/index.js:36  - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);

I don't know that I trust the line numbers exactly, but it is super weird. metro-config 0.64.0, metro 0.64.0, RN 0.64.0-rc.3. Fails both with and without hermes. Monorepos are notorious for issues with RN, so I do suspect that, but it was working on RN 0.63 and related metro setup.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the shown react-native bundle command with Metro 0.64.0 in a monorepo, then inspect the reported handles and metro-config/src/defaults/index.js around the TerminalReporter setup. Compare the behavior with the previously working RN 0.63 setup; done means the bundle, sourcemap, and assets are written and the command exits instead of hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.