我的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(加载程序)找不到文件。但是它可以识别其他所有路径