Closed
Description
Bug Report
I have created a post on stackoverflow asking about this behaviour, I haven't gotten a single reaction (yet). I asked on stackoverflow first, because I thought I might used tsc
wrong.
However, getting no reaction in conjunction with the "obvious" expected behaviour I decided to file a bug report here.
The behaviour is easily reproducable by first installing typescript like so: npm install --save-dev typescript
then creating the example.mts
file and then running ./node_modules/.bin/tsc example.mts
- that's all.
I expect *.mts
files to be convert into VALID *.mjs
files WITHOUT using a configuration, I think that's a reasonable expectation.
🔎 Search Terms
.mts
🕗 Version & Regression Information
- This is the behavior in version 4.9.4.
💻 Code
// file name: example.mts
import path from "path"
console.log(
path.resolve("./")
)
🙁 Actual behavior
// file name: example.mjs
"use strict";
exports.__esModule = true;
var path_1 = require("path");
console.log(path_1["default"].resolve("./"));
This is not a valid .mjs
file because ES Modules do not have a require
function.
🙂 Expected behavior
// file name: example.mjs
import path from "path"
console.log(
path.resolve("./")
)