Closed
Description
Bug (or bad specification) Report
If some doesn't have 'import', the tsc doesn't generate Object.defineProperty(exports, "__esModule", { value: true });
.
import type
looks standing for not generating import or code for module system in js but currently Object.defineProperty(exports, "__esModule", { value: true });
is generated.
🔎 Search Terms
In issues and on Google searched with '__esModule import type' and '__esModule generated even if import type'
🕗 Version & Regression Information
typescript: 4.1.3
- This is not a crash
⏯ Playground Link
Please ignore the compile error. I don't know what module can I use on the playground.
Playground link with relevant code
💻 Code
import type * as something from "<any path>";
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*"]
},
"target": "ES2019",
"moduleResolution": "node"
},
"include": [
"src/**/*"
]
}
🙁 Actual behavior
exports code below:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
🙂 Expected behavior
exports code below:
"use strict";
This can be a problem if I want to write ts without tools like WebPack.