@rollup/plugin-sucrase
Compile TypeScript, Flow, JSX, etc with Sucrase
Last updated 3 months ago .
· Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @rollup/plugin-sucrase 
SYNC missed versions from official npm registry.

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)

Current Tags

  • 4.0.4                                ...           latest (3 months ago)

10 Versions

  • 4.0.1                                ...           10 months ago
  • 4.0.0                                ...           a year ago
  • 3.1.1                                ...           a year ago
  • 3.1.0                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           3 years ago
  • 4.0.2                                ...           7 months ago
  • 4.0.3                                ...           4 months ago
  • 4.0.4                                ...           3 months ago
Dependencies (2)
Dev Dependencies (2)

Copyright © npmmirror.com | 浙ICP备15033595号-63 |