I am getting the following error while building the angular
library project.
Building Angular Package
Building entry point '@abc/lib'
Compiling TypeScript sources through ngc
Bundling to FESM2015
BUILD ERROR
Could not resolve entry (C:\Dev\abc\build\dist-npm\esm2015\abc-lib.js)
Error: Could not resolve entry (C:\Dev\abc\build\dist-npm\esm2015\abc-lib.js)
at error (C:\Dev\abc\node_modules\rollup\dist\rollup.js:3460:30)
at C:\Dev\AppBuilder\node_modules\rollup\dist\rollup.js:21474:17
Could not resolve entry (C:\Dev\abc\build\dist-npm\esm2015\abc-lib.js)
Error: Could not resolve entry (C:\Dev\abc\build\dist-npm\esm2015\abc-lib.js)
at error (C:\Dev\abc\node_modules\rollup\dist\rollup.js:3460:30)
at C:\Dev\AppBuilder\node_modules\rollup\dist\rollup.js:21474:17
I only get this error when I add new module
in public_api.ts
file
export * from './lib/designer.service';
export * from './lib/designer.component';
export * from './lib/designer.module';
export * from './lib/core/app-core.module'; // new module
I am using the following command to build the module
ng build lib
Any idea why I am getting this error?
I was facing the same issue. My mistake was:
In one of my service in the library, I used environment variable and imported it like this:
import { environment } from 'src/environments/environment';
So while building, it couldn't get the relative path and was showing the error. I removed it and it worked fine.
Please ensure that in your library module, you are not referencing any main project related item or not importing any relative path
I had the same issue with my component library project. I was using library A into library B by referring that A library from the dist folder. The issue was because of referring library A by path.
I solved this issue by properly installing library A into B using npm install [email protected].
This solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With