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.

Activity

mhegazy

mhegazy commented on Sep 15, 2015

@mhegazy
Contributor

looks like a duplicate of #4389.

weswigham

weswigham commented on Sep 15, 2015

@weswigham
MemberAuthor

Its a tiny part of it (it did get mentioned as the main feature people wanted broken out) - and one of the easiest for us to enable in our present emitter.

self-assigned this
on Sep 15, 2015
added
SuggestionAn idea for TypeScript
and removed
DuplicateAn existing issue was already created
on Sep 22, 2015
added
FixedA PR has been merged for this issue
on Sep 28, 2015
lazdmx

lazdmx commented on Oct 7, 2015

@lazdmx

👍

locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @lazdmx@weswigham@mhegazy

        Issue actions

          Proposal: Make ES6 Module Emit a "module" option · Issue #4806 · microsoft/TypeScript