Typescript:tsconfig.json 的 outDir 屬性無法生效
我有以下的 tsconfig.json,我想把轉譯後的輸出放在 build/ 資料夾中
{
"compileOptions": {
"module": "amd",
"noImplicitAny": "true",
"removeComments": "true",
"target": "es5",
"sourceMaps": true,
"outDir": "build/"
},
}
然而,它不起作用。我唯一能讓它工作的方式是將 outDir 作為標誌傳遞給 tsc。
我找到一個問題,詢問的正是我遇到的相同問題。然而,我使用的是 TypeScript 版本 1.8.10。我已經嘗試了那裡建議的解決方案,但仍然無法讓它運作。
有人知道我如何讓 tsc 讀取在 tsconfig.json 文件中設定的 outDir 屬性嗎?
答案#1
選項名稱是 compilerOptions,而不是 compileOptions。
{
"compilerOptions": {
"module": "amd",
"noImplicitAny": "true",
"removeComments": "true",
"target": "es5",
"sourceMaps": true,
"outDir": "build/"
},
}
