Skip to content

Commit

Permalink
[docs] Remove static config note in Metro guide, adjust formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
huntie committed Jul 3, 2023
1 parent 36e4b99 commit 9be9c27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions website/versioned_docs/version-0.72/metro.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Configuration options for Metro can be customized in your project's `metro.confi
Please see [**Configuring Metro**](https://facebook.github.io/metro/docs/configuration) on the Metro website for documentation on all available config options.
:::

In React Native, your Metro config should extend either [@react-native/metro-config](https://www.npmjs.com/package/@react-native/metro-config) or [@expo/metro-config](https://www.npmjs.com/package/@expo/metro-config). These packages contain essential defaults necessary to build and run React Native apps.
In React Native, your Metro config should extend either [`@react-native/metro-config`](https://www.npmjs.com/package/@react-native/metro-config) or [`@expo/metro-config`](https://www.npmjs.com/package/@expo/metro-config). These packages contain essential defaults necessary to build and run React Native apps.

Below is the default `metro.config.js` file in a React Native template project:

Expand All @@ -35,14 +35,14 @@ const config = {};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
```

Metro options you wish to customize can be done so within the `config` object. We strongly recommend defining all config values statically within this file.
Metro options you wish to customize can be done so within the `config` object.

### Advanced: Using a config function

Exporting a config function is an opt-in to managing the final config yourself — **Metro will not apply any internal defaults**. This pattern can be useful when needing to read the base default config object from Metro or to set options dynamically.

:::info
**From @react-native/metro-config `0.72.1`**, it is no longer necessary to use a config function to access the complete default config. See the **Tip** section below.
**From `@react-native/metro-config` 0.72.1**, it is no longer necessary to use a config function to access the complete default config. See the **Tip** section below.
:::

<!-- prettier-ignore -->
Expand All @@ -66,7 +66,7 @@ module.exports = function (baseConfig) {
```

:::tip
Using a config function is for advanced use cases. A simpler method than the above, e.g. for customising `sourceExts`, would be to read these defaults from **@react-native/metro-config**.
Using a config function is for advanced use cases. A simpler method than the above, e.g. for customising `sourceExts`, would be to read these defaults from `@react-native/metro-config`.

**Alternative**

Expand Down

0 comments on commit 9be9c27

Please sign in to comment.