Socket
Socket
Sign inDemoInstall

@react-native/metro-config

Package Overview
Dependencies
4
Maintainers
10
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
10
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.3

Fixed

iOS specific
  • Revert "Fix pod install for swift libs using new arch (#38121)" to fix build error with Xcode lower than Xcode 14.3 (8f41f25 by @kelset)

FAQs

Last updated on 10 May 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