Description
I suggest we add "es6"
as an option to the "module" flag, and the result of using it is getting ES6-style modules (import, export, and default keywords). It should be an error to choose "es6"
as the module emit type when targeting below ES6. When targeting ES6 or above, this can remain the default module emit type.
A primary personal driver for this is bundling, as bundling to an ES6 module when targeting ES6 is awkward (but possible) but bundling to other formats while still using the remaining ES6 feature set is very desirable, and, additionally, plays well into starting to break things out for #4692. A real world use would be compiling targeting node 4 - it supports most of our ES6 features, but not ES6 modules, making our ES6 emit impossible to use without an additional transpiler. :(
Additionally, it would bring us inline with the systemjs
builder's output options, which are amd
, cjs
, and es6
.