angular - Angular - 重构相对导入
问题描述
不久前,我开始在 Angular 7 中进行编码,并即时学习它。最近我认识到,相对进口不是很理想。这就是为什么我将它添加到我的tsconfig.json
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@application/*": [
"src/app/application/*"
]
}
}
现在我想重构我的导入:
import { ApplicationLogService } from './../../../service/application-log.service';
import { ApplicationLogTableComponent } from './../../tables/application-log-table/application-log-table.component';
对此:
import { ApplicationLogService } from '@application/service/application-log.service';
import { ApplicationLogTableComponent } from '@application/components/tables/application-log-table/application-log-table.component';
由于我有很多相对导入,我正在寻找一种自动重构这些的方法。你知道有什么办法吗?
解决方案
推荐阅读
- python - 熊猫数据透视表问题 - 假设我是如何构建它的?
- python - PyQt5 scrollArea with GridLayout of Image buttons blur/resize when scrolling
- c# - 如何使用 Active Directory 和数据库进行 ASP.Net Core 身份验证
- python - 如何使用内部函数返回的结果作为外部函数的参数?
- javascript - 从 JS 中的多维数组中突围——特定的 2 个问题
- c# - ASP.NET Core 项目中的 MySql 连接字符串错误
- mongodb - 当完整文档中的字段具有特定值时,MongoDB 领域触发
- c# - 移动滑块时如何播放音频剪辑?
- tensorflow - 为什么使用 CNN 进行时间序列预测时 x 大小和 y 大小必须相同?
- angular - 在角度编译器之前编辑打字稿