You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 13, 2020. It is now read-only.
Original commit messages:
* initial version of TypeScript support
* added typescript as a transpiler to karma.conf
* add typescript dependency to package.json
* allow TypeScript options to be set from the outside
* updated README.md
* added typescript to .travis.yml
* set CompilerOptions.target if it was not assigned before
* reverted changes in dist
* do not inline source file contents by default
Copy file name to clipboardExpand all lines: README.md
+24-8Lines changed: 24 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Dynamically loads ES6 modules in browsers and [NodeJS](#nodejs-use) with support
7
7
This project implements dynamic module loading through `System` exactly to the previous ES6-specified loader API at [2014-08-24 ES6 Specification Draft Rev 27, Section 15](http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#august_24_2014_draft_rev_27). The new loader implementing the [WhatWG loader spec](https://github.com/whatwg/loader) is pending alpha release on the [1.0 branch](https://github.com/ModuleLoader/es6-module-loader/tree/1.0).
8
8
9
9
* Provides an asynchronous loader (`System.import`) to [dynamically load ES6 modules](#getting-started).
10
-
* Supports both [Traceur](https://github.com/google/traceur-compiler) and [Babel](http://babeljs.io/) for compiling ES6 modules and syntax into ES5 in the browser with source map support.
10
+
* Supports [Traceur](https://github.com/google/traceur-compiler), [Babel](http://babeljs.io/) and [TypeScript](https://github.com/Microsoft/TypeScript/) for compiling ES6 modules and syntax into ES5 in the browser with source map support.
11
11
* Fully supports [ES6 circular references and live bindings](https://github.com/ModuleLoader/es6-module-loader/wiki/Circular-References-&-Bindings).
12
12
* Includes [`baseURL` and `paths` implementations](https://github.com/ModuleLoader/es6-module-loader/wiki/Configuring-the-Loader).
13
13
* Can be used as a [tracing tool](https://github.com/ModuleLoader/es6-module-loader/wiki/Tracing-API) for static analysis of modules.
@@ -30,7 +30,7 @@ For an example of a universal module loader based on this polyfill for loading A
30
30
31
31
### Getting Started
32
32
33
-
If using ES6 syntax (optional), include `traceur.js`or `babel.js` in the page first then include `es6-module-loader.js`:
33
+
If using ES6 syntax (optional), include `traceur.js`, `babel.js`or `typescript.js` in the page first then include `es6-module-loader.js`:
34
34
35
35
```html
36
36
<scriptsrc="traceur.js"></script>
@@ -45,6 +45,14 @@ To use Babel, load Babel's `browser.js` instead and set the transpiler to `babel
45
45
</script>
46
46
```
47
47
48
+
To use TypeScript, set the transpiler to `typescript` in the loader configuration:
49
+
50
+
```html
51
+
<script>
52
+
System.transpiler='typescript';
53
+
</script>
54
+
```
55
+
48
56
Then we can write any ES6 module:
49
57
50
58
mymodule.js:
@@ -76,12 +84,18 @@ If using Traceur, these can be set with:
76
84
System.traceurOptions= {...};
77
85
```
78
86
79
-
Or with Babel:
87
+
With Babel:
80
88
81
89
```javascript
82
90
System.babelOptions= {...};
83
91
```
84
92
93
+
With TypeScript:
94
+
95
+
```javascript
96
+
System.typescriptOptions= {...};
97
+
```
98
+
85
99
#### Module Tag
86
100
87
101
As well as defining `window.System`, this polyfill provides support for the `<script type="module">` tag:
@@ -102,10 +116,10 @@ See the [demo folder](https://github.com/ModuleLoader/es6-module-loader/blob/mas
0 commit comments