Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@react-native-community/cli-plugin-metro
Advanced tools
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.
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
}
}
}
});
This package provides a set of Babel presets configured for React Native applications using Metro. It is similar to @react-native-community/cli-plugin-metro in that it helps in setting up the project's Babel configuration for optimal performance with Metro, but it focuses more on the Babel presets rather than the broader Metro configuration.
Haul is a drop-in replacement for Metro bundler built on webpack, offering a similar feature set with additional customization options that webpack provides. It compares to @react-native-community/cli-plugin-metro by offering an alternative bundling solution with potentially more familiar configuration options for developers experienced with webpack.
[Removed]
This package is now relocated as
@react-native/community-cli-plugin
.To make new contributions to this package, please open a PR in the React Native repo (contributing guide).
FAQs
[Removed since 12.0.0-alpha.12]
The npm package @react-native-community/cli-plugin-metro receives a total of 470,069 weekly downloads. As such, @react-native-community/cli-plugin-metro popularity was classified as popular.
We found that @react-native-community/cli-plugin-metro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 30 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.