npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@react-native-swc/core

v0.1.3

Published

SWC-powered Metro transformer for fast React Native transpilation

Downloads

994

Readme

react-native-swc

SWC-powered transformer for Metro

CI npm (@react-native-swc/core) License: MIT Follow oblador on GitHub Follow trastknast on X

  • 🔧 Drop-in replacement for Metro Babel transform worker and minifier
  • 🦀 All transformation in Rust, no Babel in sight
  • 🏎️ Fast: transform worker is ~8× faster & full real world bundling ~3× faster
  • ⚡️ Battery friendly: 15× less CPU utilization
  • 🚇 Feature parity with Metro: HMR, inline requires, Platform.select() substituion, constant folding, delta bundles etc
  • 🔤 Native support for Flow, TypeScript, ESM, CJS, JSX
  • 🧵 Worklet/Reanimated support without Babel through custom SWC plugin
  • 🔌 Support for SWC plugins and process.env inlining
  • ⚛️ Expo Plugin for seamless integration

Install

yarn add -D @react-native-swc/core

If your app uses react-native-reanimated:

yarn add -D @react-native-swc/worklets-plugin

Setup

Expo (managed / CNG) — config plugin

Add @react-native-swc/core to app.json:

{
  "expo": {
    "plugins": ["@react-native-swc/core"]
  }
}
npx expo prebuild

The 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.

Disable worklet auto-detection if needed:

["@react-native-swc/core", { "worklets": false }]

Note. Expo config plugins run only during expo prebuild (and eas build, which invokes prebuild). Running expo start alone does not re-run plugins.

Bare React Native / Expo (manual)

// metro.config.js
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const { withSwcTransformer } = require('@react-native-swc/core');

module.exports = withSwcTransformer(mergeConfig(getDefaultConfig(__dirname), {}));

For 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:

// metro.config.js
const { getDefaultConfig } = require('expo/metro-config');
const { withSwcTransformer } = require('@react-native-swc/core');

/** @type {import('@react-native-swc/core').SwcTransformerOptions} */
const swcConfig = {
  envs: Object.fromEntries(
    Object.entries(process.env).filter(([k, v]) => k.startsWith('EXPO_PUBLIC_')),
  ),
};

module.exports = withSwcTransformer(getDefaultConfig(__dirname), swcConfig);

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.

Worklets (react-native-reanimated) — manual

// metro.config.js
const { getDefaultConfig } = require('@react-native/metro-config');
const { withSwcTransformer } = require('@react-native-swc/core');

/** @type {import('@react-native-swc/core').SwcTransformerOptions} */
const swcConfig = {
  plugins: [
    [
      '@react-native-swc/worklets-plugin',
      {
        pluginVersion: require('react-native-worklets/package.json').version,
      },
    ],
  ],
};

module.exports = withSwcTransformer(getDefaultConfig(__dirname), swcConfig);

Configuration

withSwcTransformer(metroConfig, swcOptions?) exposes an intentionally narrow surface — everything that affects Metro correctness is owned by the transform worker:

interface SwcTransformerOptions {
  plugins?: ReadonlyArray<[string, Record<string, unknown>]>;
  /**
   * `process.env.FOO`-style replacements to inline at build time. Values are
   * JSON-encoded for you and merged with the worker's built-ins (`NODE_ENV`,
   * `EXPO_OS`, …). E.g. `{ API_URL: "https://x" }` replaces
   * `process.env.API_URL` with the literal string `"https://x"`.
   */
  envs?: Record<string, string>;
}

Limitations

  • 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.
  • TypeScript sources must be isolatedModules-compatible. SWC parses each file in isolation.
  • 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.

Contributing

See CONTRIBUTING.md.

License

MIT.