我正在Angular 7中创建一个包含许多库的共享项目。当我在2个库之间有依赖关系时,会出现此错误
BUILD ERROR
Could not resolve entry (C:\development\WorkOrder.Shared.Client.Web\dist\icons\esm2015\my.library.workflows-icons.js)
Error: Could not resolve entry (C:\development\WorkOrder.Shared.Client.Web\dist\icons\esm2015\my.library.workflows-icons.js)
at error (C:\development\WorkOrder.Shared.Client.Web\node_modules\rollup\dist\rollup.js:3460:30)
at C:\development\WorkOrder.Shared.Client.Web\node_modules\rollup\dist\rollup.js:21474:17
Could not resolve entry (C:\development\WorkOrder.Shared.Client.Web\dist\icons\esm2015\my.library.workflows-icons.js)
Error: Could not resolve entry (C:\development\WorkOrder.Shared.Client.Web\dist\icons\esm2015\my.library.workflows-icons.js)
at error (C:\development\WorkOrder.Shared.Client.Web\node_modules\rollup\dist\rollup.js:3460:30)
at C:\development\WorkOrder.Shared.Client.Web\node_modules\rollup\dist\rollup.js:21474:17
我尝试了所有事情。其中之一是将tsconfig.lib.json文件的路径添加到我有依赖关系的库中。 但是错误仍然存在
答案 0 :(得分:0)
我遇到了这个问题,花了几个小时找出解决方案。最后,我进行了以下更改以解决此问题
假设library2依赖于library1
import { something } from 'libary2/lib/models'
应更改为
import { something } from '../../models';
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/lib",
"baseUrl": "./",
....
"paths": {
"library1": ["../../dist/library1"],
"library1/*": ["../../dist/library1/*"],
}
}