Collection of SWC(Rust) implementations for React Native.
| Feature flag | Sub-crate | Upstream package |
|---|---|---|
codegen |
swc_react_native_codegen |
@react-native/babel-plugin-codegen |
worklets |
swc_react_native_worklets |
react-native-worklets/plugin |
swc_react_native is the umbrella crate. No features are enabled by default — pick what you need
(features = ["codegen"]) or turn on all for everything. Each sub-crate can also be depended on
directly.
- mise for environment management
mise installThis installs the Rust toolchain and just task runner as defined in mise.toml.
All tasks are available via just:
just # List all available recipesjust build # Debug build
just build-release # Release buildjust lint # Run clippy with strict warnings
just fmt # Apply rustfmt
just fmt-check # Check formatting without applyingjust test # Run all tests
just snapshot-review # Interactively review snapshot diffs (cargo insta review)just roll # lint + fmt-check + testMeasured on Apple M1 Pro, 200 iterations over the per-target fixtures in
bench/<target>/fixtures/.
| Target | Babel total | Babel avg / op | SWC total | SWC avg / op | Speedup |
|---|---|---|---|---|---|
codegen |
944.9ms | 4.724ms | 13.1ms | 0.066ms | ~72x |
worklets |
4554.4ms | 22.772ms | 61.3ms | 0.307ms | ~74x |
Run with just bench <target> [n] (after just setup-bench <target> once).
crates/
swc-react-native/ # Umbrella crate — feature-gated re-exports of each transform
swc-react-native-codegen/ # SWC visitor for the codegen transform
swc-react-native-worklets/ # SWC visitor for the worklets transform
| Upstream package | Rust location |
|---|---|
@react-native/babel-plugin-codegen |
crate swc_react_native_codegen |
react-native-worklets Babel plugin |
crate swc_react_native_worklets |