【发布时间】:2021-02-10 05:24:24
【问题描述】:
我从打字稿开始。我从一个空文件夹开始,然后运行这些命令来设置我的打字稿开发。
npm init
npm install typescript
npm install @types/node
然后我制作了一个 tsconfig 文件
npx tsc --init
我尝试在 tsconfig.json 中更改我的输出目录,例如 "outDir": "./dist",
但这似乎不起作用。转译的文件仍然进入 src 文件夹。 我有一个像这样的文件夹结构:
root
|_ node_modules
|_ src
|_ index.ts
|_ dist
|_package.json
|_tsconfig.json
|_package-lock.json
这里是 tsconfig.json 文件
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}
【问题讨论】:
-
@RandyCasburn 回答了一个完全不同的场景。我的 tsconfig 文件无法正常工作。
标签: javascript node.js typescript tsconfig