UNPKG

1.3 kBMarkdownView Raw
1# rollup-plugin-typescript
2![travis-ci](https://travis-ci.org/rollup/rollup-plugin-typescript.svg?branch=master)
3
4Seamless integration between Rollup and Typescript.
5
6## Why?
7See [rollup-plugin-babel](https://github.com/rollup/rollup-plugin-babel).
8
9## Installation
10
11```bash
12npm install --save-dev rollup-plugin-typescript
13```
14
15## Usage
16
17```js
18import typescript from 'rollup-plugin-typescript';
19
20export default {
21 entry: 'main.ts',
22
23 plugins: [
24 typescript()
25 ]
26}
27```
28
29All options are as per the [Typescript's Compiler Options](https://github.com/Microsoft/TypeScript/wiki/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 (by default, all files are transpiled).
30
31## Issues
32
33TypeScript 1.6.2 isn't able to transpile to ES5 while preserving ES2015 modules. That's why we use a prerelease of [TypeScript 1.7.0](https://github.com/Microsoft/TypeScript/wiki/Roadmap#17) for ease of use. :rocket: This option can be easily be overridden.
34
35```js
36import typescript from 'rollup-plugin-typescript';
37import * as ts from 'typescript';
38
39export default {
40 entry: 'main.ts',
41
42 plugins: [
43 typescript({
44 target: ts.ScriptTarget.ES6
45 })
46 ]
47}
48```
49
50## License
51
52MIT