I have been attempting to bundle a group of classes into an Angular Library. I diligently followed the instructions provided at: https://angular.io/guide/creating-libraries:
ng new my-pkg --no-create-application
cd my-pkg
ng generate library my-lib
Subsequently, I removed the automatically generated module, component, and service, and integrated my own classes.
I made sure to explicitly export the necessary components in public-api.ts, like this:
export { MyLibServiceFactory } from './lib/my-lib-service-factory';
export { MyLibService } from './lib/my-lib-service';
export { MyLibConfiguration } from './lib/my-lib-configuration';
The compilation process for the library completed without any errors or warnings. Upon trying to import it into my app.module.ts with:
import { MyLibServiceFactory, MyLibConfiguration } from "@my-pkg/my-lib";
However, during compilation, I encountered the following error messages:
./src/app/app.module.ts:51:241-260 - Error: export 'MyLibServiceFactory' (imported as 'MyLibServiceFactory') was not found in '@my-pkg/my-lib' (possible exports: MyLibComponent, MyLibModule, MyLibService)
./src/app/app.module.ts:52:15-33 - Error: export 'MyLibConfiguration ' (imported as 'MyLibConfiguration ') was not found in '@my-pkg/my-lib' (possible exports: MyLibComponent, MyLibModule, MyLibService)
I am certain that I must be overlooking something simple, but despite hours of searching, I have yet to find a solution.
My development environment includes Angular 15 and Typescript 4.9. The library itself utilizes core Angular methods such as HttpClient.