# @rollup/plugin-swc

> Transpile JavaScript/TypeScript code with swc.

Latest version **0.4.1** (published 2026-05-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rollup/plugin-swc
pnpm add @rollup/plugin-swc
yarn add @rollup/plugin-swc
bun add @rollup/plugin-swc
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2026-05-29 |
| First published | 2023-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.0.0 |
| Dependencies | 2 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3758 |
| Author | Peter Placzek |
| Maintainers | shellscape, rich_harris, guybedford, lukastaegert |
| Keywords | rollup, plugin, swc, speedy-web-compiler, npm, modules, rollup-plugin |

## Links

- npm: https://www.npmjs.com/package/@rollup/plugin-swc
- Repository: https://github.com/rollup/plugins
- Homepage: https://github.com/rollup/plugins/tree/master/packages/swc#readme
- Issues: https://github.com/rollup/plugins/issues
- npm.io page: https://npm.io/package/@rollup/plugin-swc

## Dependencies (2)

- [smob](https://npm.io/package/smob.md) ^1.4.0
- [@rollup/pluginutils](https://npm.io/package/@rollup/pluginutils.md) ^5.0.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.4.1 (latest) — 2026-05-29
- 0.4.0 — 2024-09-06
- 0.3.1 — 2024-06-05
- 0.3.0 — 2023-11-09
- 0.2.1 — 2023-10-05
- 0.2.0 — 2023-08-29
- 0.1.1 — 2023-05-17
- 0.1.0 — 2023-04-04

## README

[npm]: https://img.shields.io/npm/v/@rollup/plugin-swc
[npm-url]: https://www.npmjs.com/package/@rollup/plugin-swc
[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-swc
[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-swc

[![npm][npm]][npm-url]
[![size][size]][size-url]
[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)

# @rollup/plugin-swc

🍣 A Rollup plugin to transpile TypeScript/JavaScript with the speedy-web-compiler (swc).

The plugin makes it possible to avoid the usage of `@rollup/plugin-babel` and `@rollup/plugin-typescript`.
It is also blazingly fast 🔥 (between 20 - 70 times faster than Babel depending on how many cpu cores are used).

## Requirements

This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v3.0+.

## Install

Using npm:

```console
npm install @swc/core @rollup/plugin-swc --save-dev
```

## Usage

Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:

```typescript
import swc from '@rollup/plugin-swc';

export default {
  input: 'src/index.js',
  output: {
    dir: 'output',
    format: 'cjs'
  },
  plugins: [swc()]
};
```

Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api).

## Options

The plugin accepts an object as input parameter to modify the default behaviour.

### `swc`

- Type: [Options](https://swc.rs/docs/configuration/swcrc)
- Default: `undefined`

```typescript
import type { Options as SWCOptions } from '@swc/core';

declare type Options = {
  swc?: SWCOptions;
};
```

### `exclude`

- Type: `String` | `Array[...String]`
- Default: `null`

A [picomatch pattern](https://github.com/micromatch/picomatch),
or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored.

### `include`

- Type: `String` | `Array[...String]`
- Default: `null`

A [picomatch pattern](https://github.com/micromatch/picomatch),
or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.

## Alternatives

Alternative transpiler/transformer, which are also officially offered, are [Babel](https://www.npmjs.com/package/@rollup/plugin-babel) and [Sucrase](https://www.npmjs.com/package/@rollup/plugin-sucrase).
Both Babel and Sucrase are written in JavaScript, whereas the core of SWC is written in Rust. In addition, Sucrase transforms code to ES6+, whereas babel and SWC also support ES3 upwards.

## Meta

[CONTRIBUTING](/.github/CONTRIBUTING.md)

[LICENSE (MIT)](/LICENSE)

---
_Source: https://npm.io/package/@rollup/plugin-swc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
