Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-native-community/cli-plugin-metro

Package Overview
Dependencies
Maintainers
30
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-native-community/cli-plugin-metro

[Removed since 12.0.0-alpha.12]

  • 12.3.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1M
increased by15.87%
Maintainers
30
Weekly downloads
 
Created

What is @react-native-community/cli-plugin-metro?

The @react-native-community/cli-plugin-metro package is a plugin for the React Native CLI that integrates Metro, the JavaScript bundler for React Native. This plugin facilitates the configuration and customization of Metro for React Native projects, enhancing the development experience by providing tools for optimizing and managing the bundling process.

What are @react-native-community/cli-plugin-metro's main functionalities?

Custom Metro Configuration

Allows developers to customize the Metro configuration specific to their React Native project needs, such as defining file extensions, blacklisting files, and setting transformer options.

module.exports = {
  resolver: {
    sourceExts: ['jsx', 'js', 'ts', 'tsx', 'json'],
    blacklistRE: blacklist([/ignore_files\/.*$/])
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
  serializer: {
    getPolyfills: () => [require.resolve('react-native/Libraries/polyfills/console.js')]
  }
};

Optimizing Bundling

Enhances the performance of the JavaScript bundling process by allowing developers to define optimization settings such as minification and mangling to improve load times and application performance.

const { makeMetroConfig } = require('@react-native-community/cli-plugin-metro');
const config = makeMetroConfig({
  projectRoot: __dirname + '/src',
  watchFolders: [__dirname + '/node_modules'],
  transformer: {
    minifierConfig: {
      mangle: true,
      keep_classnames: true,
      keep_fnames: true,
      output: {
        ascii_only: true,
        quote_style: 3,
        wrap_iife: true
      }
    }
  }
});

Other packages similar to @react-native-community/cli-plugin-metro

FAQs

Package last updated on 19 Feb 2024

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc