Skip to content

es6 imports translated to modules even when output set to es6  #643

Closed

Description

@tomitrescak

Hi

Up until latest update my es6 imports were left the way they was when transpilig to es6.
From the latest update now they are transpiled to the module representation.

For example:

import TabControl from "../../components/tabs/tab_control";

is transpiled to

var tab_control_1 = require("../../components/tabs/tab_control");

The worst part is, that it breaks the TSX transpilation as for example

  <TabControl tabs={this.state.tabs}>
            {
              this.props.validations.map((validation: BoardValidation, index: number) => {
                return <BoardValidationView key={index} />
              })
            }
</TabControl>

is transpiled to:

<tab_control_1.default tabs={this.state.tabs}>
            {this.props.validations.map((validation, index) => {
            return <BoardValidationView key={index} />;
        })}
          </TabControl>

Note how the closing tag is not transpiled.

I am sure that this is bug in Microsoft transpilation, but can the transpilation of import statements be disabled? Up until today all was working well ... now none of my TS project runs ;((

For completeness, here is my tsconfig

{
    "compilerOptions": {
        "target": "es6",
        "declaration": false,
        "noImplicitAny": true,
        "removeComments": false,
        "noLib": false,
        "preserveConstEnums": true,
        "noEmitHelpers": true,
        "suppressImplicitAnyIndexErrors": true,
        "watch": true,
        "outDir": "../dist",
        "jsx": "preserve"
    },
...
}

Activity

  1. tomitrescak commented on Oct 5, 2015

    @tomitrescak
    Author

    Thanks to the description you left in releases, I've found out that this happens from version 7.1.2 in which you have updated typescript to the latest version. I have also left a comment within their issues.

  2. patroza commented on Oct 5, 2015

    @patroza

    I can confirm this issue

  3. tomitrescak commented on Oct 5, 2015

    @tomitrescak
    Author

    Do now roll back to 7.1.1 which has a previous version of typescript. Seems like a TS issue.

  4. basarat commented on Oct 6, 2015

    @basarat
    Member

    TypeScript issue report : microsoft/TypeScript#5110

  5. basarat commented on Oct 6, 2015

    @basarat
    Member
  6. added a commit that references this issue on Oct 27, 2015
  7. self-assigned this
    on Oct 30, 2015
  8. basarat commented on Oct 30, 2015

    @basarat
    Member
  9. basarat commented on Oct 30, 2015

    @basarat
    Member

    Tsconfig / TypeScript : for people using "target" : "es6" they should now also use "module": "es6" in tsconfig compilerOptions

  10. locked and limited conversation to collaborators on Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions