index.ts
const m = require("./test");
console.log(m.a);
test.ts
module.exports = {
a: 1,
b: 2,
};
After compilation
index.js
var m = require("./test");
console.log(m.a);
test.js
module.exports = {
a: 1,
b: 2
};
The module specified in tsconfig.json is ES6. It should be compiled into a modular way such as import {a} from 'test'
. Why is it still the modular way of commonjs?