My Angular 6 project with TypeScript version "2.7.2" has tsconfig.json as
{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./src", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2017", "dom" ] }, "paths":{ "@services/*": ["app/services/*"] } } I tried importing a service using the above path
import { AppService } from '@services/app.service'; But I'm getting this error on running ng serve
ERROR in src/app/app.module.ts(20,26): error TS2307: Cannot find module '@services/app.service'.
P.S.- Without the paths
import { AppService } from './services/app.service'; is working fine.