# @rollup/plugin-sucrase

> Compile TypeScript, Flow, JSX, etc with Sucrase

Latest version **5.1.0** (published 2026-03-05) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.1.0 |
| Published | 2026-03-05 |
| First published | 2019-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.0.0 |
| Dependencies | 2 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3758 |
| Author | Rich Harris |
| Maintainers | shellscape, rich_harris, guybedford, lukastaegert |
| Keywords | rollup, plugin, sucrase, typescript, flow, jsx |

## Links

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

## Dependencies (2)

- [sucrase](https://npm.io/package/sucrase.md) ^3.27.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

- 5.1.0 (latest) — 2026-03-05
- 5.0.2 — 2023-10-05
- 5.0.1 — 2022-10-21
- 5.0.0 — 2022-10-10
- 4.0.4 — 2022-05-14
- 4.0.3 — 2022-04-13
- 4.0.2 — 2022-01-05
- 4.0.1 — 2021-10-01
- 4.0.0 — 2021-07-26
- 3.1.1 — 2021-07-26
- 3.1.0 — 2020-06-28
- 3.0.2 — 2020-05-20
- 3.0.1 — 2020-05-11
- 3.0.0 — 2019-12-25

## README

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

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

# @rollup/plugin-sucrase

🍣 A Rollup plugin which compiles TypeScript, Flow, JSX, etc with Sucrase.

## Requirements

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

## Install

Using npm:

```console
npm install @rollup/plugin-sucrase --save-dev
```

## Usage

Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin. An example of compiling TypeScript (the node-resolve plugin is added to automatically add file extensions, since TypeScript expects not to find them):

```js
import sucrase from '@rollup/plugin-sucrase';
import resolve from '@rollup/plugin-node-resolve';

export default {
  input: 'src/index.ts',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    resolve({
      extensions: ['.js', '.ts']
    }),
    sucrase({
      exclude: ['node_modules/**'],
      transforms: ['typescript']
    })
  ]
};
```

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 following [Sucrase options](https://github.com/alangpierce/sucrase#transforms) may be passed as options for this plugin:

- `disableESTransforms`
- `enableLegacyBabel5ModuleInterop`
- `enableLegacyTypeScriptModuleInterop`
- `injectCreateRequireForImportRequire`
- `jsxFragmentPragma`
- `jsxImportSource`
- `jsxPragma`
- `jsxRuntime`
- `preserveDynamicImport`
- `production`
- `transforms`

### `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.

## Meta

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

[LICENSE (MIT)](/LICENSE)

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