繁体   English   中英

项目目录外的 tsconfig.json 文件

[英]tsconfig.json file outside of project directory

我有一个项目portal 随着我的开发,我意识到我本质上需要在存储库中放置多个项目。 因此,我现在有一个像这样的项目结构:

在此处输入图片说明

我想知道,是否有可能在portalshop目录之外都有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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM