
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
metro-transformer-registry
Advanced tools
Use multiple transformer for metro-bundler, the main bundler of react-native
Use different transformers in metro-bundler, which is the main bundler for react-native
First install dependencies:
yarn add metro-transformer-registry
Config your 'rn-cli.config.js'
'use strict';
const path = require('path');
const blacklist = require('metro-bundler/src/blacklist');
const config = {
// Define file extensions for every source code.
getSourceExts() {
return ['js', 'json', 'ts', 'tsx', 'txt'];
},
// Use Metro-Transformer-Registry as transformer entry.
getTransformModulePath() {
return require.resolve('metro-transformer-registry');
},
// Define every rule list.
getTransformRuleList() {
return [
{
include: '/\.tsx?$',
transformer: require('metro-transformer-registry/transformers/typescript'),
},
{
include: '/\.txt$',
transformer: require('metro-transformer-registry/transformers/raw'),
},
]
}
};
module.exports = config;
If you wish to use typescript with react native, you also should install following dependencies:
yarn add typescript sourcemap
and add a tsconfig.json file:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"jsx": "react",
"strict": true,
"importHelpers": true,
"noImplicitAny": true,
"experimentalDecorators": true,
"outDir": "./lib",
"rootDir": "./src",
"lib": [
"es5",
"es6",
"es2015",
"DOM"
]
},
"compileOnSave": false,
"exclude": [
"node_modules"
]
}
FAQs
Use multiple transformer for metro-bundler, the main bundler of react-native
We found that metro-transformer-registry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.