tsc 命令未编译到 outDir

Zac*_*Zac 4 typescript tsconfig typescript-typings

我对配置还很陌生tsconfig.json,但我只是想将 src 目录编译为编译后的 javascript,但它只是不使用outDir编译后的代码创建文件夹。

这是我的tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "target": "es2017",
    "skipLibCheck": true,
    "noImplicitAny": true,
    "noEmit": true,
    "moduleResolution": "node",
    "sourceMap": true,

    "outDir": "dist",

    "baseUrl": ".",
    "jsx": "react",
    "paths": {
      "MyApplicationTypes" : ["@types/MyApplicationTypes/index.d.ts"],
      "*": [
        "node_modules/*"
      ]
    },
    "typeRoots" : ["@types"]
  },
  "include": [
    "server/**/*",
    "client/**/*"
  ],
  "exclude" : [
    "./client/dist",
    "./client/.cache",
    "./dist",
    "./.cache"
  ]
}
Run Code Online (Sandbox Code Playgroud)

我的npm run build命令很简单tsc,它运行并完成,没有任何错误或任何其他输出。

没有dist/创建,即使我手动创建该文件夹,它仍然是空的。到底是怎么回事?!

我的文件夹结构非常简单,包含服务器和客户端:

- project
  - client
    - index.html
    - index.tsx
    ... etc
  - server
    - index.ts 
    ... etc
Run Code Online (Sandbox Code Playgroud)

有什么理由吗?我的 tsconfig 非常简单

Shi*_*gla 6

您已noEmit设置为true. 正如这里所说,noEmit仅用于类型检查。

有关更多信息,请查看TS 文档。