{"id":51195851,"url":"https://github.com/oblador/react-native-swc","last_synced_at":"2026-06-27T20:31:01.881Z","repository":{"id":354257493,"uuid":"1221884734","full_name":"oblador/react-native-swc","owner":"oblador","description":"⚡️ SWC-powered transformer \u0026 minifier for Metro","archived":false,"fork":false,"pushed_at":"2026-06-01T18:17:48.000Z","size":1121,"stargazers_count":118,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-06-01T20:08:26.525Z","etag":null,"topics":["metro","react-native","swc","swc-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oblador.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["oblador"]}},"created_at":"2026-04-26T19:59:34.000Z","updated_at":"2026-06-01T18:18:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/oblador/react-native-swc","commit_stats":null,"previous_names":["oblador/react-native-swc"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/oblador/react-native-swc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblador%2Freact-native-swc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblador%2Freact-native-swc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblador%2Freact-native-swc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblador%2Freact-native-swc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oblador","download_url":"https://codeload.github.com/oblador/react-native-swc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblador%2Freact-native-swc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34867616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-27T02:00:06.362Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["metro","react-native","swc","swc-plugin"],"created_at":"2026-06-27T20:30:57.216Z","updated_at":"2026-06-27T20:31:01.859Z","avatar_url":"https://github.com/oblador.png","language":"TypeScript","funding_links":["https://github.com/sponsors/oblador"],"categories":[],"sub_categories":[],"readme":"# react-native-swc\n\n**SWC-powered transformer for Metro**\n\n[![CI](https://github.com/oblador/react-native-swc/actions/workflows/ci.yml/badge.svg)](https://github.com/oblador/react-native-swc/actions/workflows/ci.yml)\n[![npm (@react-native-swc/core)](https://img.shields.io/npm/v/@react-native-swc/core?label=react-native-swc)](https://www.npmjs.com/package/react-native-swc)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)\n[![Follow oblador on GitHub](https://img.shields.io/github/followers/oblador?label=Follow%20%40oblador\u0026style=social)](https://github.com/oblador)\n[![Follow trastknast on X](https://img.shields.io/twitter/follow/trastknast?label=Follow%20%40trastknast\u0026style=social)](https://twitter.com/trastknast)\n\n- 🔧 Drop-in replacement for Metro Babel transform worker and minifier\n- 🦀 All transformation in Rust, no Babel in sight\n- 🏎️ Fast: transform worker is ~8× faster \u0026 full real world bundling ~3× faster\n- ⚡️ Battery friendly: 15× less CPU utilization\n- 🚇 Feature parity with Metro: HMR, inline requires, `Platform.select()` substituion, constant folding, delta bundles etc\n- 🔤 Native support for Flow, TypeScript, ESM, CJS, JSX\n- 🧵 Worklet/Reanimated support without Babel through custom SWC plugin\n- 🔌 Support for SWC plugins and `process.env` inlining\n- ⚛️ Expo Plugin for seamless integration\n\n## Install\n\n```sh\nyarn add -D @react-native-swc/core\n```\n\nIf your app uses `react-native-reanimated`:\n\n```sh\nyarn add -D @react-native-swc/worklets-plugin\n```\n\n## Setup\n\n### Expo (managed / CNG) — config plugin\n\nAdd `@react-native-swc/core` to `app.json`:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\"@react-native-swc/core\"]\n  }\n}\n```\n\n```sh\nnpx expo prebuild\n```\n\nThe plugin writes (or updates) a `metro.config.js` wired up to `withSwcTransformer`. If `react-native-worklets` is listed in your dependencies, the worklets SWC plugin is registered automatically. Any `EXPO_PUBLIC_*` env vars present at metro start are inlined into the bundle, matching Expo's default Babel pipeline. If you already have a manual `withSwcTransformer` call, the plugin leaves your config alone.\n\nDisable worklet auto-detection if needed:\n\n```json\n[\"@react-native-swc/core\", { \"worklets\": false }]\n```\n\n\u003e **Note.** Expo config plugins run only during `expo prebuild` (and `eas build`, which invokes prebuild). Running `expo start` alone does not re-run plugins.\n\n### Bare React Native / Expo (manual)\n\n```js\n// metro.config.js\nconst { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');\nconst { withSwcTransformer } = require('@react-native-swc/core');\n\nmodule.exports = withSwcTransformer(mergeConfig(getDefaultConfig(__dirname), {}));\n```\n\nFor Expo without the config plugin, swap `@react-native/metro-config` for `expo/metro-config`. To match Expo's default `EXPO_PUBLIC_*` env-var inlining, forward those vars through `swcConfig.envs`:\n\n```js\n// metro.config.js\nconst { getDefaultConfig } = require('expo/metro-config');\nconst { withSwcTransformer } = require('@react-native-swc/core');\n\n/** @type {import('@react-native-swc/core').SwcTransformerOptions} */\nconst swcConfig = {\n  envs: Object.fromEntries(\n    Object.entries(process.env).filter(([k, v]) =\u003e k.startsWith('EXPO_PUBLIC_')),\n  ),\n};\n\nmodule.exports = withSwcTransformer(getDefaultConfig(__dirname), swcConfig);\n```\n\n`process.env.EXPO_PUBLIC_FOO` references in your source are then replaced with the literal value at bundle time. Anything not prefixed with `EXPO_PUBLIC_` is left alone.\n\n### Worklets (`react-native-reanimated`) — manual\n\n```js\n// metro.config.js\nconst { getDefaultConfig } = require('@react-native/metro-config');\nconst { withSwcTransformer } = require('@react-native-swc/core');\n\n/** @type {import('@react-native-swc/core').SwcTransformerOptions} */\nconst swcConfig = {\n  plugins: [\n    [\n      '@react-native-swc/worklets-plugin',\n      {\n        pluginVersion: require('react-native-worklets/package.json').version,\n      },\n    ],\n  ],\n};\n\nmodule.exports = withSwcTransformer(getDefaultConfig(__dirname), swcConfig);\n```\n\n## Configuration\n\n`withSwcTransformer(metroConfig, swcOptions?)` exposes an intentionally narrow surface — everything that affects Metro correctness is owned by the transform worker:\n\n```ts\ninterface SwcTransformerOptions {\n  plugins?: ReadonlyArray\u003c[string, Record\u003cstring, unknown\u003e]\u003e;\n  /**\n   * `process.env.FOO`-style replacements to inline at build time. Values are\n   * JSON-encoded for you and merged with the worker's built-ins (`NODE_ENV`,\n   * `EXPO_OS`, …). E.g. `{ API_URL: \"https://x\" }` replaces\n   * `process.env.API_URL` with the literal string `\"https://x\"`.\n   */\n  envs?: Record\u003cstring, string\u003e;\n}\n```\n\n### Limitations\n\n- **Custom Babel plugins from `babel.config.js` are not executed.** Reanimated is covered by `@react-native-swc/worklets-plugin` in this repo, for other use cases see [SWC plugin directory](https://plugins.swc.rs).\n- **TypeScript sources must be [isolatedModules](https://www.typescriptlang.org/tsconfig#isolatedModules)-compatible.** SWC parses each file in isolation.\n- **Flow handling is automatic.** User `.js` files are parsed as Flow only if they carry an `@flow` / `@noflow` pragma or if they first fail to parse as plain JavaScript.\n\n## Contributing\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## License\n\n[MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foblador%2Freact-native-swc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foblador%2Freact-native-swc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foblador%2Freact-native-swc/lists"}