【问题标题】:tsc command not compiling to outDirtsc 命令未编译为 outDir
【发布时间】:2021-01-24 18:30:22
【问题描述】:

我对@9​​87654321@ 配置非常陌生,但我只是想将我的 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"
  ]
}

我的npm run build 命令只是普通的tsc,它运行并完成没有任何错误或任何其他输出。

dist/ 没有创建,即使我手动创建文件夹,它也保持为空。怎么回事?!

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

- project
  - client
    - index.html
    - index.tsx
    ... etc
  - server
    - index.ts 
    ... etc

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

【问题讨论】:

    标签: typescript typescript-typings tsconfig


    【解决方案1】:

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

    更多信息请查看TS docs.

    【讨论】:

      猜你喜欢
      • 2012-09-23
      • 1970-01-01
      • 2018-12-13
      • 2018-03-23
      • 2011-07-05
      • 1970-01-01
      • 1970-01-01
      • 2022-11-08
      • 2017-09-18
      相关资源
      最近更新 更多