[英]tsconfig.json file outside of project directory
我有一個項目portal
。 隨着我的開發,我意識到我本質上需要在存儲庫中放置多個項目。 因此,我現在有一個像這樣的項目結構:
我想知道,是否有可能在portal
和shop
目錄之外都有tsconfig.json
文件,這意味着打字稿編譯器選項將適用於兩個項目? 當我在門戶項目上執行npm run serve
時,我似乎收到此錯誤:
Error: Cannot find "C:\Git\ui\portal\tsconfig.json" file. Please check webpack and ForkTsCheckerWebpackPlugin configuration.
Possible errors:
- wrong `context` directory in webpack configuration (if `tsconfig` is not set or is a relative path in fork plugin configuration)
- wrong `tsconfig` path in fork plugin configuration (should be a relative or absolute path)
我不太確定它來自哪里,因為我的代碼庫中沒有定義這樣的文件路徑。
tsconfig.json
的內容是:
{
"compilerOptions": {
"target": "ES2020",
"module": "ESNext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": "portal",
"types": [
"webpack-env"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"portal/src/**/*.ts",
"portal/src/**/*.tsx",
"portal/src/**/*.vue"
],
"exclude": [
"node_modules"
]
}
試試這個:保留你現有的tsconfig.json
,然后在每個文件夾中創建一個包含以下內容的tsconfig.json
:
{
"extends": "../tsconfig.json"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.