我正在构建一个angular库(clan-auth),其中包含我正在构建的几个Angular项目的公共部分。当我从私有npm Repository安装库时,我可以正常使用它的功能。然而,当我将库与npm link
链接时,我得到了Error TS2307: Cannot find module 'clan-auth' or its corresponding type declarations
。我想这样做是为了更简单地开发库组件,这样我就可以看到它在其中一个应用程序中实现的样子。
查看nodes-modules文件夹,依赖项似乎安装正确,库上的更改也正确反映在nodes-modules库中
package.json从库:
{
"name": "clan-auth",
"version": "0.0.1",
"publishConfig": {
"registry": "https://privatNPMRepo"
},
"peerDependencies": {
"@angular/common": "^13.3.0",
"@angular/core": "^13.3.0",
"ngx-cookie-service": "^13.1.2",
"angularx-qrcode": "^13.0.6"
},
"dependencies": {
"tslib": "^2.3.0"
}
}
我的项目文件结构:
- ...
- libraries (Angular Workspace)
- projects
- auth (the clan-auth library is inside this folder)
- project (the other angular Project)
对于npm链接,我转到.../libraries/projects/auth
并执行npm link
,然后我转到.../project
并执行npm link clan-auth
1条答案
按热度按时间olqngx591#
你有没有在项目中添加指向链接库的符号链接?
tsconfig.json
中的paths
配置: