Skip to content

Proposal: Make ES6 Module Emit a "module" option #4806

Closed
@weswigham

Description

@weswigham

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions