JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 53097
  • Score
    100M100P100Q33471F
  • License MIT

Seamless integration between Rollup and TypeScript.

Package Exports

  • rollup-plugin-typescript

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rollup-plugin-typescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rollup-plugin-typescript

travis-ci

Seamless integration between Rollup and Typescript.

Why?

See rollup-plugin-babel.

Installation

npm install --save-dev rollup-plugin-typescript

Usage

// rollup.config.js
import typescript from 'rollup-plugin-typescript';

export default {
  entry: './main.ts',

  plugins: [
    typescript()
  ]
}

All options are as per the Typescript's Compiler Options, except options.include and options.exclude (each a minimatch pattern, or array of minimatch patterns), which determine which files are transpiled by Typescript (all .ts and .tsx files by default).

JSX

JSX can be enabled by setting the jsx option to one of 'none', 'preserve'and 'react'.

// rollup.config.js
import typescript from 'rollup-plugin-typescript';

export default {
  entry: './main.tsx',

  plugins: [
    typescript({
      jsx: 'react'
    })
  ]
}

TypeScript version

rollup-plugin-typescript uses TypeScript 1.7.5 per default. Should your project require it, you can override the TypeScript version used for transpiling the sources.

typescript({
  typescript: require('some-fork-of-typescript')
})

Issues

TypeScript 1.6.2 isn't able to transpile to ES5 while preserving ES2015 modules. That's why this plugin requires TypeScript 1.7.0 or greater. The ScriptTarget can always be changed should your project require it! 🚀

// rollup.config.js
import typescript from 'rollup-plugin-typescript';
import * as ts from 'typescript';

export default {
  entry: './main.ts',

  plugins: [
    typescript({
      target: ts.ScriptTarget.ES6
    })
  ]
}

License

MIT