gpt4 book ai didi

typescript - tsc 命令没有编译到 outDir

转载 作者:行者123 更新时间:2023-12-05 02:48:50 27 4
gpt4 key购买 nike

我是 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"
]
}

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

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

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

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

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

最佳答案

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

更多信息请查看TS docs.

关于typescript - tsc 命令没有编译到 outDir,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64284042/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com