So, I'm using this tsconfig.json
:
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"module": "ES6",
"moduleResolution": "node",
"outDir": "./lib/",
"paths": {
"@src/*": ["src/*"]
},
"preserveConstEnums": true,
"removeComments": true,
"sourceMap": true,
"target": "ES6"
},
"include": [
"global.d.ts",
"src/**/*.ts"
]
}
Where you can see the alias @src
is defined for my code.
tsc
/webpack
have no problem building everything but while editing in VS Code, I can't get rid of this error message when I import something as
import { xxx } from '@src/xxx';
Anyone with the same problem? For me, it's weird to see this because if it's compiling/building properly (from tsc and webpack), it means the configuration is correct. So why VS Code is displaying this error msg? It's just annoying but I wanna solve it.
tsconfig.json
file is also using the standard name (no custom -p
option for tsc
) so, VS Code should be able to read it automatically, right? Or any extra configuration is needed for the IDE?
I had the same issue. In my case running Cmd+Shift+P > Typescript: Restart TS Server
did the trick and error message disappeared
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With