Socket
Socket
Sign inDemoInstall

@react-native/metro-config

Package Overview
Dependencies
4
Maintainers
11
Versions
321
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native/metro-config


Version published
Maintainers
11
Created

Package description

What is @react-native/metro-config?

@react-native/metro-config is a configuration package for Metro, the JavaScript bundler used by React Native. It allows developers to customize the Metro bundler's behavior, such as transforming files, resolving modules, and optimizing the build process.

What are @react-native/metro-config's main functionalities?

Custom Transformer

This feature allows you to specify a custom transformer for Metro. In this example, the configuration is set to use the 'react-native-typescript-transformer' to handle TypeScript files.

const { getDefaultConfig } = require('@react-native/metro-config');

const config = getDefaultConfig(__dirname);

config.transformer = {
  babelTransformerPath: require.resolve('react-native-typescript-transformer')
};

module.exports = config;

Custom Resolver

This feature allows you to customize the resolver settings. In this example, the configuration is modified to include additional file extensions like 'ts' and 'tsx' for TypeScript support.

const { getDefaultConfig } = require('@react-native/metro-config');

const config = getDefaultConfig(__dirname);

config.resolver = {
  sourceExts: ['jsx', 'js', 'ts', 'tsx']
};

module.exports = config;

Asset Plugins

This feature allows you to specify asset plugins for Metro. In this example, the configuration is set to use 'expo-asset/tools/hashAssetFiles' to handle asset files.

const { getDefaultConfig } = require('@react-native/metro-config');

const config = getDefaultConfig(__dirname);

config.transformer = {
  assetPlugins: ['expo-asset/tools/hashAssetFiles']
};

module.exports = config;

Other packages similar to @react-native/metro-config

Changelog

Source

v0.72.1

Added

iOS specific
  • Add warning to help users migrate away from the interop layer. (a702d0515f by @cipolleschi)
  • Allow to lookup for ViewManager without the RCT prefix in the Interop Layer (a28881a3d7 by @cipolleschi)

Changed

  • react-native/metro-config now includes all base config values from metro-config (bbcedd385b by @huntie)
  • Bump CLI to 11.3.3 (da84901f78 by @kelset)
  • Bumped @react-native/metro-config to 0.72.7, @react-native/gradle-plugin to 0.72.11, @react-native/virtualized-lists to 0.72.6 (95db9f98f2 by @kelset)

Fixed

  • react-native/virtualized-lists does not need react-test-renderer at runtime (7a2a3278d0 by @tido64)
Android specific
iOS specific

FAQs

Last updated on 30 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc