frankwallis / plugin-typescript

TypeScript loader for SystemJS
MIT License
248 stars 47 forks source link

Support for "module": "ESNext" #208

Closed aluanhaddad closed 7 years ago

aluanhaddad commented 7 years ago

plugin-typescript currently issues a warning, and rightly, when targeting module formats other than system, and es2015. In the latter case, imports are retained for further processing by Babel or via the SystemJS Builder.

TypeScript 2.4.0 added support for the proposed Dynamic Import feature.

plugin-typescript users are already able to take advantage of this feature when using "module": "system" but TypeScript does not allow the syntax to be used with "module": "es2015", as this is not a feature of the correspondingly named ECMAScript edition, and instead introduces "module": "esnext" for those who wish to forward the module syntax to another tool as mentioned.

This option actually works just fine with plugin-typescript right now, but it results in warnings as the enum value is not recognized.

It would be great if plugin-typescript extended its list of supported formats to include "module": "esnext". This option has the same behavior as "module": "es2015", except that it recognizes and retains dynamic import expressions, enabling the use cases mentioned above. I would be happy to submit a PR for this.

frankwallis commented 7 years ago

Fixed in 7.1.0