Angular Library Import Errors With Multiple Entry Points

129 views Asked by At

I am using Angular Workspaces and creating an additional entry point for AG-Grid inside of the Angular library to reduce the initial main bundle size as the grid isn't needed right away.

My app structure is:

projects
    my-library
        ag-grid
           grid
           ng-package.json
           public-api.ts
        src
           constants
           services
           lib
             other smaller components (button, input, etc)    
           ng-package.json
           public-api.ts 
     app1
        src
           features (trying to import my-library/ag-grid here)
tsconfig.json
    

Inside my tsconfig.json file at the project root, I have paths set to the following:

{
   "paths": {
       "my-library/*": ["dist/my-library/*"],
       "my-library:: [dist/my-library"]
   }
}
 

When I try building the library and the project I keep getting an import error. Here is my build command:

npm run build:my-library && ng serve app1 --port-4200 --open

And my errors inside of app1 component modules/models are basically just a ton of:

Module not found: Error: Can't resolve 'my-library/ag-grid"

I have been referencing this article: https://blog.ag-grid.com/reducing-angular-library-contributions-to-the-main-bundle/

Any thoughts as to why that module isn't found is appreciated.

0

There are 0 answers