🌜
ğŸŒž
@rollup/plugin-sucrase

@rollup/plugin-sucrase

v4.0.4

Compile TypeScript, Flow, JSX, etc with Sucrase

npm install @rollup/plugin-sucrase

README

npm size libera manifesto

@rollup/plugin-sucrase

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

Requirements

This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.

Install

Using npm:

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

Usage

Create a rollup.config.js configuration file 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):

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 or the API.

Options

The following Sucrase options may be passed as options for this plugin:

  • enableLegacyBabel5ModuleInterop
  • enableLegacyTypeScriptModuleInterop
  • jsxFragmentPragma
  • jsxPragma
  • production
  • transforms

exclude

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

A minimatch pattern, 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 minimatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.

Meta

CONTRIBUTING

LICENSE (MIT)

General

License
MIT
Typescript Types
Built-in
Tree-shakeable
Yes

Popularity

GitHub Stargazers
2,784
Community Interest
2,624
Number of Forks
446

Maintenance

Commits
10/219/22050
Last Commit
Open Issues
25
Closed Issues
710
Open Pull Requests
17
Closed Pull Requests
115

Versions

Versions Released
10/219/2201
Latest Version Released
May 14, 2022
Current Tags
latest4.0.4

Dependencies

Dependencies (2)
Dev Dependencies (2)

Contributors

shellscape
shellscape
Commits: 352
lukastaegert
lukastaegert
Commits: 43
NotWoods
NotWoods
Commits: 39
benmccann
benmccann
Commits: 20
tjenkinson
tjenkinson
Commits: 15
danielgindi
danielgindi
Commits: 14
LarsDenBakker
LarsDenBakker
Commits: 13
Andarist
Andarist
Commits: 8
guybedford
guybedford
Commits: 7
TrySound
TrySound
Commits: 7
chengcyber
chengcyber
Commits: 4
Kocal
Kocal
Commits: 3
pnevares
pnevares
Commits: 3
Acionyx
Acionyx
Commits: 3
wesleygrimes
wesleygrimes
Commits: 3