TypeScript 多个文件编译成一个 js 文件

更改 tsconfig.json 文件中的配置项:
tsconfig.json 文件是由 tsc --init 命令生成的,参考:TypeScript 配置文件 - tsconfig.json

{
  "compilerOptions": {
    "module": "amd",
    "outFile": "./build/page.js",
    "rootDir": "./src"
  }
}

可以通过 "rootDir": "./src" 指定 ts 文件的目录。
原来是 "module":"commonjs",需要改成 "module": "amd"。amd 是一种模块化规范。


相关文章:
TypeScript 配置文件 - tsconfig.json

posted @ 2021-01-11 10:21  qianbuhan  阅读(3831)  评论(0编辑  收藏  举报