Angular 12 个库构建失败并出现错误 [object Object]

Angular 12 Library Builds Fails with error [object Object]

我一直在尝试在 angular 12 中构建这个库。但是我得到的唯一错误消息是 [object Object]。我可以尝试如何调试问题?

> nx run user-pref:build:production 
> Building Angular Package

> ------------------------------------------------------------------------------
> Building entry point '@umn/user-pref'
> ------------------------------------------------------------------------------
> ✖ Compiling with Angular sources in Ivy partial compilation mode.
> [object Object]
> 
>  NX   ERROR  Running target "user-pref:build" failed

调试了几天终于找到原因了

库中的一个组件使用其文件位置“../../../file.ts”而不是@library-name/file.[=10= 从另一个库导入文件]

我在我的项目中遇到了同样的错误,经过几天的调试和调查,我发现了这个 issue on github,它准确地描述了我的问题:

it turned out the error can be triggered by generating a lib and changing its name >in the inline package.json from @org/a/b/c to @org/a-b-c without adjusting the >paths in tsconfig.base.json

这真的很烦人,控制台没有打印任何有意义的错误!