I am having an issue where my path aliases (e.g.- import * as fromUsers from '@store/user/user.reducer';
) are not being recognized within VS Code. (Note- on compiling everything works fine). VS Code reports "Cannot find module '@store/user/user.reducer'"
I have both a <root>/tsconfig.json
, and a <root>/src/tsconfig.spec.json
which look like:
tsconfig.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["dom", "es2015"],
"baseUrl": "./src",
"paths": {
"@store/*": ["app/store/*"],
"@core/*": ["app/core/*"],
"@components/*": ["app/components/*"],
"@app/*": ["app/*"],
"@assets/*": ["assets/*"],
"@env": ["environments/environment"],
"@pages/*": ["pages/*"],
"@theme/*": ["theme/*"]
},
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5"
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "src/**/*.spec.ts", "src/**/__tests__/*.ts"],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
},
"types": ["jasmine"]
}
and src/tsconfig.spec.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": ".",
"module": "commonjs",
"target": "es5",
"allowJs": true,
"paths": {
"@store/*": ["app/store/*"],
"@core/*": ["app/core/*"],
"@components/*": ["app/components/*"],
"@app/*": ["app/*"],
"@assets/*": ["assets/*"],
"@env": ["environments/environment"],
"@pages/*": ["pages/*"],
"@theme/*": ["theme/*"]
}
},
"include": ["**/*.spec.ts"],
"exclude": ["node_modules"]
}
Any thoughts on how I can get VS Code to recognize those aliases, so that I dont keep seeing errors being reported in the IDE?