[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-11598":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":14,"stars7d":13,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":17,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":30,"discoverSource":31},11598,"react-native-swc","oblador\u002Freact-native-swc","oblador","⚡️ SWC-powered transformer & minifier for Metro","",null,"TypeScript",121,3,2,0,30,6,1.81,"MIT License",false,"main",[23,24,25,26],"metro","react-native","swc","swc-plugin","2026-06-12 02:02:32","# react-native-swc\n\n**SWC-powered transformer for Metro**\n\n[![CI](https:\u002F\u002Fgithub.com\u002Foblador\u002Freact-native-swc\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Foblador\u002Freact-native-swc\u002Factions\u002Fworkflows\u002Fci.yml)\n[![npm (@react-native-swc\u002Fcore)](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@react-native-swc\u002Fcore?label=react-native-swc)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Freact-native-swc)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue.svg)](.\u002FLICENSE)\n[![Follow oblador on GitHub](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Ffollowers\u002Foblador?label=Follow%20%40oblador&style=social)](https:\u002F\u002Fgithub.com\u002Foblador)\n[![Follow trastknast on X](https:\u002F\u002Fimg.shields.io\u002Ftwitter\u002Ffollow\u002Ftrastknast?label=Follow%20%40trastknast&style=social)](https:\u002F\u002Ftwitter.com\u002Ftrastknast)\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 & 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\u002FReanimated 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\u002Fcore\n```\n\nIf your app uses `react-native-reanimated`:\n\n```sh\nyarn add -D @react-native-swc\u002Fworklets-plugin\n```\n\n## Setup\n\n### Expo (managed \u002F CNG) — config plugin\n\nAdd `@react-native-swc\u002Fcore` to `app.json`:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\"@react-native-swc\u002Fcore\"]\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\u002Fcore\", { \"worklets\": false }]\n```\n\n> **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 \u002F Expo (manual)\n\n```js\n\u002F\u002F metro.config.js\nconst { getDefaultConfig, mergeConfig } = require('@react-native\u002Fmetro-config');\nconst { withSwcTransformer } = require('@react-native-swc\u002Fcore');\n\nmodule.exports = withSwcTransformer(mergeConfig(getDefaultConfig(__dirname), {}));\n```\n\nFor Expo without the config plugin, swap `@react-native\u002Fmetro-config` for `expo\u002Fmetro-config`. To match Expo's default `EXPO_PUBLIC_*` env-var inlining, forward those vars through `swcConfig.envs`:\n\n```js\n\u002F\u002F metro.config.js\nconst { getDefaultConfig } = require('expo\u002Fmetro-config');\nconst { withSwcTransformer } = require('@react-native-swc\u002Fcore');\n\n\u002F** @type {import('@react-native-swc\u002Fcore').SwcTransformerOptions} *\u002F\nconst swcConfig = {\n  envs: Object.fromEntries(\n    Object.entries(process.env).filter(([k, v]) => 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\u002F\u002F metro.config.js\nconst { getDefaultConfig } = require('@react-native\u002Fmetro-config');\nconst { withSwcTransformer } = require('@react-native-swc\u002Fcore');\n\n\u002F** @type {import('@react-native-swc\u002Fcore').SwcTransformerOptions} *\u002F\nconst swcConfig = {\n  plugins: [\n    [\n      '@react-native-swc\u002Fworklets-plugin',\n      {\n        pluginVersion: require('react-native-worklets\u002Fpackage.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>]>;\n  \u002F**\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:\u002F\u002Fx\" }` replaces\n   * `process.env.API_URL` with the literal string `\"https:\u002F\u002Fx\"`.\n   *\u002F\n  envs?: Record\u003Cstring, string>;\n}\n```\n\n### Limitations\n\n- **Custom Babel plugins from `babel.config.js` are not executed.** Reanimated is covered by `@react-native-swc\u002Fworklets-plugin` in this repo, for other use cases see [SWC plugin directory](https:\u002F\u002Fplugins.swc.rs).\n- **TypeScript sources must be [isolatedModules](https:\u002F\u002Fwww.typescriptlang.org\u002Ftsconfig#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` \u002F `@noflow` pragma or if they first fail to parse as plain JavaScript.\n\n## Contributing\n\nSee [CONTRIBUTING.md](.\u002FCONTRIBUTING.md).\n\n## License\n\n[MIT](.\u002FLICENSE).\n","react-native-swc 是一个基于 SWC 的 Metro 变换器和压缩工具，专为 React Native 项目设计。该项目使用 Rust 编写，完全替代了 Babel 在 Metro 中的作用，提供约8倍的变换速度提升和3倍的整体打包加速，并且显著降低了 CPU 使用率。它支持 Flow、TypeScript、ESM、CJS 和 JSX 等多种语言特性，同时通过自定义插件实现了对 Reanimated 工作流的支持。此外，还提供了与 Expo 的无缝集成选项。适用于追求构建性能优化及希望减少 JavaScript 转换开销的所有 React Native 应用场景。","2026-06-11 03:32:08","CREATED_QUERY"]