【发布时间】:2021-04-21 19:10:26
【问题描述】:
为了缩短我添加的库中的导入路径
"paths": {
"@services": ["lib/services"]
}
致我的tsconfig.lib.json。我的目录结构大多是默认的,有多个项目使用一个库:
projects
library/
src/
lib/
services/
index.ts
tsconfig.lib.json
[projects...]
我想使用类似的导入
import {service} from "@services";
就在我的库中 - 但到目前为止,我收到“找不到模块 @services”错误。
我猜路径不正确 - 但我不知道如何解决这个问题。有人有想法吗?
edit: Used baseUrl: "src" - 这适用于构建,但在使用 ng serve 启动其中一个项目时不起作用(由于相同的错误,“找不到模块”)。 (未使用 aot 标志)
谢谢。
【问题讨论】:
-
你是否按照文档base url must be specified if "paths" is.添加了baseurl bcs
标签: angular typescript