{"library":"metro-react-native-babel-transformer","title":"metro-react-native-babel-transformer","description":"Babel transformer for React Native applications, part of the Metro bundler ecosystem. Current stable version is 0.84.3 (released 2025-04). Release cadence is frequent patches and minor versions. Key differentiator: it is the default transformer in React Native projects, handling JSX, Flow, and React Native-specific transforms. It integrates with Metro's caching and module system. Alternatives like @babel/preset-react are lower-level and do not include React Native's custom plugin set.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install metro-react-native-babel-transformer"],"cli":null},"imports":["const metroReactNativeBabelTransformer = require('metro-react-native-babel-transformer');","const { transform } = require('metro-react-native-babel-transformer');","const { getCacheKey } = require('metro-react-native-babel-transformer');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const babelTransformer = require('metro-react-native-babel-transformer');\nconst { transform, getCacheKey } = require('metro-react-native-babel-transformer');\n\n// Example: transform a simple JSX file\nconst code = `import React from 'react'; const App = () => <View />;`;\nconst result = transform({\n  filename: 'App.js',\n  src: Buffer.from(code),\n  options: {\n    dev: true,\n    hot: true,\n    platform: 'ios',\n    projectRoot: '/path/to/project',\n    publicPath: '/assets',\n    minify: false,\n  },\n});\nconsole.log(result.code); // Transformed code string\nconsole.log(result.map); // Source map object\n\n// Cache key\nconsole.log(getCacheKey());","lang":"javascript","description":"Demonstrates importing the transformer and running a basic transformation with typical options.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}