Issue Summary
Looking for help to resolve the red squiggly line error in Visual Studio Code indicating that @angular/core
cannot be resolved. Any ideas?
Problem Details
I am working on a service-only module intended for NPM publication. I have specified @angular/core
as a peer dependency in my package.json
file and have it installed. The service is located in a 'lib' folder and I have included the import statement
import { Injectable } from '@angular/core';
. However, Visual Studio Code shows a red squiggly line under this import statement and displays the error message [ts] cannot find the module @angular/core
when hovered over.
Here is how the dependencies are defined in my package.json
and they are all correctly installed:
"peerDependencies": {
"@angular/core": "*"
},
"devDependencies": {
"@angular/compiler": "^5.2.9",
"@angular/compiler-cli": "^5.2.9",
"rollup": "^0.57.0",
"typescript": "^2.7.2",
"uglify-js": "^3.3.15"
}
I have also attempted to add the following to my tsconfig.json
:
"paths": {
"@angular/core": ["node_modules/@angular/core"],
}
Despite this addition, the red squiggly line persists.
I have taken a screenshot of the current setup: