tsconfig.json中的路径别名不适用于所有路径

时间:2018-06-21 14:10:30

标签: visual-studio typescript webpack

我的tsconfig.json中有设置路径别名,看起来像是

"paths": {
    "@services/*": [ "./src/app/services/*" ],
    "@interfaces/*": [ "./src/app/interfaces/*" ],
    "@directives/*": [ "./src/app/directives/*" ],
    "@enums/*": [ "./src/app/enum/*" ],
    "@classes/*": [ "./src/app/class/*" ],
    "@components/*": [ "./src/app/main/components/*" ]
},

然后像这样导入它们

import { PageStateNames } from "@classes/PageStateNames";
import { UsersService } from "@services/users.service";

但是,由于某些原因,除了@enums@classes之外的所有东西都可以工作。谁能帮我找出原因?路径是正确的,实际上Visual Studio可以识别路径是正确的,但是webpack(加载程序)找不到文件。但是它可以识别其他所有路径

0 个答案:

没有答案