Skip to content

Docs: Improve readability for React Native developers - #2121

Merged
vzaidman merged 1 commit into
react:mainfrom
vzaidman:export-D125674124
Oct 28, 2026
Merged

vzaidman merged 1 commit into
react:mainfrom
vzaidman:export-D125674124

Conversation

@vzaidman

@vzaidman vzaidman commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Rewrites the docs for React Native developers who know Metro from the product side (metro.config.js, npx react-native start, Fast Refresh) but not its internals, and who often land on a single section from search. Builds on #2077 and #2084, which fixed inaccuracies and documented missing options.

  • Concepts as a glossary: Concepts.md defines the bundling stages and shared terms (module, entry point, dependency graph, platform, project root and watch folders, file watching, Haste) once, and each stage says how to customize it. Other pages link to these definitions instead of re-explaining them.
  • Standalone pages and sections: each page opens with what it covers and when you'd need it; each config section says what it controls.
  • Vanilla Metro first: examples run Metro directly (npx metro serve, npx metro build, plain config exports), and note where a framework wrapper (e.g. React Native's or Expo's getDefaultConfig) changes a default instead of assuming it. The JavaScript API is framed as a framework/tooling integration point, not the usual way to run Metro.
  • Less duplication: API.md is the single reference for the JavaScript API. GettingStarted.md is a guided introduction with short examples (the CLI, createConnectMiddleware, metro.config.js) that links to it.
  • Bundling page: "Bundle Formats" becomes "Bundling": how Metro builds a bundle (stages, module IDs, serialization order), modules and scripts (with a polyfill example), then the formats. The RAM bundle section explains when RAM bundles help and why React Native doesn't use them with Hermes, with an example and a compact description of both formats.
  • Concrete examples where a statement isn't obvious, e.g. the URLs Metro's middleware serves, what a wrapped module looks like in a bundle, how a specifier resolves to a file, mergeConfig results, and the files runBuild writes.
  • Recent behavior: inlineRequires inlining destructured requires, fileMapCacheDirectory being created if missing, and what getPackageForModule returns for symlinked and missing paths.
  • New "File watching" section in Concepts.md, linked from every mention of watching.
  • Tightened prose throughout, consistent "Type:" / "Defaults to" phrasing, and removed trailing whitespace.

Page URLs are unchanged, and headings keep their text where possible, so existing links keep working. The exceptions: Bundling.md's sections are reorganized (the format headings keep their text), and Concepts.md's "Modules" heading is now "Module", under "Terminology".

Changelog: [Internal]

Differential Revision: D125674124

Summary:
Rewrites the docs for React Native developers who know Metro from the product side (`metro.config.js`, `npx react-native start`, Fast Refresh) but not its internals, and who often land on a single section from search. Builds on react#2077 and react#2084, which fixed inaccuracies and documented missing options.

- **Concepts as a glossary:** `Concepts.md` defines the bundling stages and shared terms (module, entry point, dependency graph, platform, project root and watch folders, file watching, Haste) once, and each stage says how to customize it. Other pages link to these definitions instead of re-explaining them.
- **Standalone pages and sections:** each page opens with what it covers and when you'd need it; each config section says what it controls.
- **React Native context:** examples use `mergeConfig(getDefaultConfig(__dirname), ...)` from `react-native/metro-config`, and options note where React Native's defaults differ from Metro's.
- **Less duplication:** `API.md` is the single reference for the JavaScript API. `GettingStarted.md` is a guided introduction with short examples (the CLI, `createConnectMiddleware`, `metro.config.js`) that links to it.
- **Bundling page:** "Bundle Formats" becomes "Bundling": how Metro builds a bundle (stages, module IDs, serialization order), modules and scripts (with a polyfill example), then the formats. The RAM bundle section explains when RAM bundles help and why React Native doesn't use them with Hermes, with an example and a compact description of both formats.
- **Concrete examples** where a statement isn't obvious, e.g. the URLs Metro's middleware serves, what a wrapped module looks like in a bundle, how a specifier resolves to a file, `mergeConfig` results, and the files `runBuild` writes.
- **Recent behavior:** `inlineRequires` inlining destructured requires, `fileMapCacheDirectory` being created if missing, and what `getPackageForModule` returns for symlinked and missing paths.
- **New "File watching" section** in `Concepts.md`, linked from every mention of watching.
- **Tightened prose** throughout, consistent "Type:" / "Defaults to" phrasing, and removed trailing whitespace.

Page URLs are unchanged, and headings keep their text where possible, so existing links keep working. The exceptions: `Bundling.md`'s sections are reorganized (the format headings keep their text), and `Concepts.md`'s "Modules" heading is now "Module", under "Terminology".

Changelog: [Internal]

Differential Revision: D125674124
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 26, 2026
@meta-codesync

meta-codesync Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@vzaidman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125674124.

Comment thread docs/API.md Resolved
Comment thread docs/API.md Resolved
Comment thread docs/API.md Resolved
@robhogan

Copy link
Copy Markdown
Collaborator

React Native context: examples use mergeConfig(getDefaultConfig(__dirname), ...) from react-native/metro-config, and options note where React Native's defaults differ from Metro's.

I'm not sure about this as a goal - those are really community CLI specifics, at a time when we're actively recommending a framework. I'd be inclined to pick either vanilla Metro or represent Expo alongside RN CLI.

@huntie huntie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One blocking comment first!

Comment thread docs/API.md Resolved
Comment thread docs/API.md Resolved
@vzaidman vzaidman changed the title Improve docs Docs: Improve readability for React Native developers Oct 28, 2026
@vzaidman
vzaidman merged commit 81a4565 into react:main Oct 28, 2026
19 checks passed
@vzaidman
vzaidman deleted the export-D125674124 branch October 28, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants