my project was generated with [Angular CLI] version 1.2.6.
I can compile the project and it works fine, but I always get error in vs code telling me cannot find mo
I was facing this issue in my angular 5
application today. And the fix which helped me, was simple. I added "moduleResolution": "node"
to the compilerOptions
in the tsconfig.json
file. My complete tsconfig.json
file content is below.
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
The moduleResolution
specify module resolution strategy. The value of this settings can be node
or classic
. You may read more about this here.