【发布时间】:2021-10-16 11:24:37
【问题描述】:
如何将 typescript 模块构建为 javascript 模块
这是我的 tsconfig 文件
{
"compilerOptions": {
"target": "ES5",
"module": "CommonJS",
"declaration": true,
"outDir": "./dist",
"strict": true,
"moduleResolution": "Node",
"esModuleInterop": true,
"skipLibCheck": true
}
}
我想构建这个代码 --------------
打字稿模块
import getData from './getData';
export default {
getData
};
节点模块
const getData = require("./getData")';
module.exports = {
getData
};
【问题讨论】:
-
我不明白你的问题,但要编译 TS,你需要命令 tsc。
标签: javascript node.js typescript node-modules module-build