How to make an "alias" for a long path in angular-cli?

I am using the Angular CLI. How to convert a path from:

import {AppConfig, AppConfigInterface} from '../../../app.config'; 

to something like:

 import {AppConfig, AppConfigInterface} from 'root/app.config'; 
+5
source share
2 answers

try this in tsconfig.json:

  { "compileOnSave": false, "compilerOptions": { "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/*"] // here! } } } 
+4
source

angular The default module directory cli is defined in /angular-cli.json you can try '/app.config' if you need root

0
source

Source: https://habr.com/ru/post/1262426/


All Articles