Skip to content

Should still transpile import statements for ES6 when --module commonjs #4900

Closed
@ThatRendle

Description

@ThatRendle

Node.js 4.x now supports enough ES6 syntax that it is desirable to use --target ES6.

But when you specify ES6, TypeScript stops transpiling the import statements, even when the --module commonjs flag is supplied, and Node does not (and apparently will never) support the import syntax.

The combination --target ES6 --module commonjs should result in regular ES6 output but with e.g.

import * as express from "express";

transpiled to

var express = require("express");

Activity

ThatRendle

ThatRendle commented on Sep 21, 2015

@ThatRendle
Author

Appears that this is already being discussed in #4389 - closing.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ThatRendle

        Issue actions

          Should still transpile import statements for ES6 when `--module commonjs` · Issue #4900 · microsoft/TypeScript