0

I have a project portal. As I developed, I realised I need multiple projects within the repository essentially. Therefore, I now have a project structure like so:

enter image description here

I was wondering, would it be possible to have tsconfig.json file outside of both portal and shop directories meaning the typescript compiler options would apply across both projects? I seem to be getting this error when I do npm run serve on the portal project:

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)

I'm not too sure where its coming from because no where in my codebase has such filepath defined.

The content of the tsconfig.json is:

{
 "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"
 ]
}
KTOV
  • 559
  • 3
  • 14
  • 39

1 Answers1

3

Try this: keep your existing tsconfig.json, then in each of the folders create a tsconfig.json with the following content:

{
    "extends": "../tsconfig.json"
}
Kamen Minkov
  • 3,324
  • 1
  • 14
  • 21