Since I began working on this project, I've been encountering a peculiar issue. When importing modules and files in my Angular components/classes using import
, I face an error in VSCode when the paths use the base path symbol @
. Strangely enough, despite the warning, I can compile and run the application without any problems as all imports are successfully pulled in.
This issue has been lingering for some time now, but it becomes particularly inconvenient when I attempt to navigate to the definition of an object from one of the imported modules in VSC and it fails to locate the file.
All members of my team are utilizing the same code base (and tsconfig file) in VSCode without experiencing this hiccup, indicating that it may not be a problem with the tsconfig file or codebase setup itself, but rather something specific to my own VSCode environment. Despite scouring through StackOverflow and other resources for solutions, I have yet to find a resolution. Any assistance would be greatly appreciated.
Example of import at the top of an Angular ts file:
import { SigningAction } from '@middlemass.signing/dto/signing-action';
Upon hovering over any import with a path shortcut prefix, here is the warning message I receive:
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
}
}