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 是一种模块化规范。

浙公网安备 33010602011771号