Skip to content

tsc emits __esModule even for ModuleKind.None #14351

@yume-chan

Description

@yume-chan

TypeScript Version: 2.3.0-dev.20170227

Code

const typescript = require("typescript");

const result = typescript.transpileModule(`let s:string = "string"`, {
    compilerOptions: {
        target: "es5",
        module: typescript.ModuleKind.None // I don't need module!!
    }
});

console.log(result.outputText)

Expected behavior:

"use strict";
var s = "string";

Actual behavior:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true }); // I cannot run this in browsers!!
var s = "string";

I believe it's caused by #13709 that fixed #13709, but ModuleKind.None also uses CommonJS emit routine (module.ts#L14) so it's also affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions