I've been having this strange issue since I've started working on this project a while back. In my various Angular components/classes/etc. I'm pulling in other modules and files using import. For any of these that use the base path @ symbol, I'm getting an error in VSCode (note: @angular/core and other packages work... issue is just with the paths). What's weird is that I can compile and run the application with no issues... the imports all get pulled in successfully despite the warning.
I've just been ignoring this issue for a while, but it causes one issue that's very inconvenient... if I try to go to the definition of, for example, an object that's in one of the imported modules, VSC doesn't bring me to that file because it can't seem to find it.
Everyone on my team uses the exact same code base (and the same tsconfig file) in VSCode without experiencing this problem. So it doesn't seem to be an issue with the tsconfig file or codebase setup itself, but rather something up with my VSCode itself. I've scoured StackOverflow and elsewhere for solutions but haven't had any luck. Any suggestions would be much appreciated.
Import example (top of an Angular ts file):
import { SigningAction } from '@middlemass.signing/dto/signing-action';
Here's the warning I get when hovering over any import with a path shortcut prefix:
Cannot find module '@middlemass.signing/dto/signing-action' or its corresponding type declarations.
tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
],
"module": "es2015",
"baseUrl": "./",
"paths": {
"@middlemass.sending/*": [
"projects/middlemass-sending/src/*"
],
"@middlemass.sending/shared/*": [
"projects/middlemass-sending/src/shared/*"
],
"@middlemass.sending/utils/*": [
"projects/middlemass-sending/src/shared/utils*"
],
"@middlemass.sending/services/*": [
"projects/middlemass-sending/src/services/*"
],
"@middlemass.sending/dto/*": [
"projects/middlemass-sending/src/dto/*"
],
"@middlemass.sending/env/*": [
"projects/middlemass-sending/src/environments/*"
],
"@middlemass.sending/styles/*": [
"projects/middlemass-sending/src/scss/*"
],
"@middlemass.sending/locale/*": [
"projects/middlemass-sending/locale/*"
],
"@middlemass.signing/locale/*": [
"projects/middlemass-signing/locale/*"
],
"@middlemass.signing/dto/*": [
"projects/middlemass-signing/src/app/core/dto/*"
],
"@middlemass.signing/services/*": [
"projects/middlemass-signing/src/app/core/services/*"
],
"@middlemass.signing/shared/*": [
"projects/middlemass-signing/src/app/shared/*"
],
"@middlemass.signing": [
"projects/middlemass-signing/src"
],
"@middlemass.signing/*": [
"projects/middlemass-signing/src/*"
],
"@middlemass.common": [
"projects/middlemass-common/src"
],
"@middlemass.common/*": [
"projects/middlemass-common/src/*"
]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"preserveWhitespaces": false
}
}