In my Angular 9 (Everything up to date) I use several own libraries. The libraries are included in the tsconfig.json using the "paths" property and then used it in the application.
I create a new library which using a lot of the CdkPortal from the Angular Cdk Library, I get the following error messages while compiling the root Application which imports the Library. Before that I compile the library itself and there is no build error:
Compiling cap-gui-components : module as esm5
Error: Error on worker #1: Error: Failed to find exported name of node (CapGuiSettingsDialogContainerComponent
All components which are loaded dynamically with the Cdk will generate this error message. Theoretically, these components do not need to be exported in the index.ts file because they are only used in the library itself. If I export them, I do not get the error message.
Full Error Message:
ompiling cap-gui-components : module as esm5
Error: Error on worker #1: Error: Failed to find exported name of node (CapGuiSettingsDialogContainerComponent = /** @class */ (function () {
// ************************************************************************************************
/** Constructor */
...code...
in 'C:/Users/Arbeit/dev/CaptureWebApplications/dist/cap-gui-components/fesm5/cap-gui-components.js'.
at Object.findExportedNameOfNode (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\find_export.js:35:19)
at LogicalProjectStrategy.emit (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\emitter.js:228:38)
at ReferenceEmitter.emit (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\imports\src\emitter.js:71:44)
at Object.toR3Reference (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\util.js:192:31)
at NgModuleDecoratorHandler._toR3Reference (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:417:31)
at C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:196:83
at Array.map (<anonymous>)
at NgModuleDecoratorHandler.analyze (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\ng_module.js:196:48)
at NgccTraitCompiler.TraitCompiler.analyzeTrait (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:345:40)
at analyze (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:297:58)
at ClusterMaster.onWorkerMessage (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:168:27)
at C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:52:95
at ClusterMaster.<anonymous> (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:248:57)
at step (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\tslib\tslib.js:139:27)
at Object.next (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\tslib\tslib.js:120:57)
at C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\tslib\tslib.js:113:75
at new Promise (<anonymous>)
at Object.__awaiter (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\tslib\tslib.js:109:16)
at EventEmitter.<anonymous> (C:\Users\Arbeit\dev\CaptureWebApplications\node_modules\@angular\compiler-cli\ngcc\src\execution\cluster\master.js:242:32)
at EventEmitter.emit (events.js:311:20)
An unhandled exception occurred: NGCC failed.
See "C:\Users\Arbeit\AppData\Local\Temp\ng-dpI2TJ\angular-errors.log" for further details.
Why do I need to export these Components? Is there a other way to build that library without error and without export these components?