是否有任何选项可以在角度 2-5 中命名模块文件夹路径?

nin*_*dev 3 typescript angular angular5

有没有办法在 Angular 5 中为自定义路径使用命名空间?目前我使用

import { AuthService } from './../../modules/auth/auth.service';
Run Code Online (Sandbox Code Playgroud)

我想要实现的是使用@module或自定义@name特定路径。代码应如下所示,可用于每个文件夹级别

import { AuthService } from '@modules/auth/auth.service';
Run Code Online (Sandbox Code Playgroud)

Zla*_*tko 5

是的,配置中有paths属性tsconfig.json

{
   ...
   "compilerOptions": {
       ...
       "paths": {
           "@core/*": ["app/core/*"],
           "@shared/*": ["app/shared/*"]
    }      
}
Run Code Online (Sandbox Code Playgroud)