I have an NX Angular project that has been working just fine for a few years. Now I actually wanted to migrate some older legacy lib modules to standalone component and thus executed the migration schematics for it. With a little manual tweaking all NX components are compilling just fine. There is only one that produces the following error and I am really lost on how to debug this because it really doesn’t provide much info:
------------------------------------------------------------------------------
Building entry point '@flx/layout-ultima'
------------------------------------------------------------------------------
- Compiling with Angular sources in Ivy full compilation mode.
✖ Compiling with Angular sources in Ivy full compilation mode.
NX Cannot destructure property 'pos' of 'file.referencedFiles[index]' as it is undefined.
TypeError: Cannot destructure property 'pos' of 'file.referencedFiles[index]' as it is undefined.
at getReferencedFileLocation (C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:123885:10)
at fileIncludeReasonToDiagnostics (C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:130405:31)
at processReason (C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:126782:62)
at Array.forEach (<anonymous>)
at createDiagnosticExplainingFile (C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:126734:42)
at C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:124478:11
at Array.forEach (<anonymous>)
at updateAndGetProgramDiagnostics (C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:124476:43)
at getProgramDiagnostics (C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:125180:38)
at getSemanticDiagnosticsForFile (C:Usersxxxgitxxxflx-frontendsnode_modules.pnpm[email protected]node_modulestypescriptlibtypescript.js:125216:7)
Here are the verions used:
- NX: 19.5.4
- Angular: 18.1.2
- Typescript: 5.5.4
It’s not that big of a library so I went through all the .ts files but there are no obvious errors. All imports and referenced files seem to be ok and working.
When I undo the migration to standalone components everything works again so I assume it must be related to that.
I tried to google the issue but without much luck either and my knowledge of the compillation process is not good enough to really deep dive into it. Maybe sombody can provide a pointer where I can look or what might becausing this error so I can narrow the scope down?
Thanks
Thorsten