Does not package with ng-packagr
See original GitHub issueBug, feature request, or proposal:
When using ng-packagr, I receive a build error "ENOENT: no such file or directory, open ‘…/node_modules/@angular/packages/material…’
What is the expected behavior?
It packages properly with no build errors.
What is the current behavior?
It errors out and doesn’t build successfully but I can do ng build without issues.
What are the steps to reproduce?
- Start a new project using cli.
ng new material-test
- Update dependencies to use @angular/material 2.0.0-beta.12 and all peer dependencies.
- Add ng-packagr to dev dependencies, all necessary files for ng-packagr (public_api & ng-package.json) and run
npm install
. - Import any material module into main app module
- run
ng-packagr -p ng-package.json
.
OR
- Checkout https://github.com/nmrichards/material-issue-project
- run
npm install
- run
npm run packagr
What is the use-case or motivation for changing an existing behavior?
To be able to use ng-packagr with beta.12 in personal libraries.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular 4.4.4 Material 2.0.0-beta.12 TypeScript 2.3.3
Is there anything else we should know?
I also receive messages during the ng-packagr process stating a number of items are imported but never used even if I only import one module from material library. See file below for said messages. In this particular test project, I’m only importing MatIconModule into the main app module. If I run ng-packagr on beta.11, I don’t receive the build error but still get the imported but not used messages and it successfully builds. I will also be submitting this to the ng-packagr project as I’m not sure if this an ng-packagr issue or material beta.12 issue but I only get the issue if I import any module from material beta.12. And also putting on Stack Overflow in case it’s just an issue that I’m causing due to something I’m doing wrong, in which case I apologize for submitting this issue.
EDIT: ng-packagr issue can be tracked here #172
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:25 (4 by maintainers)
Top GitHub Comments
@willshowell adding material to lib.externals in ng-package.json:
seems to have fixed my issue, my library is now building successfully with ng-packagr.
That is not to say there still isn’t some issue here with the esm5 packaging’s sourcemaps. I think someone consuming the esm5 package would likely face the same errors.
I don’t think this should have been closed. Some clarification: we aren’t trying to use ng-packagr to build material itself. We are working on library projects that include material, and using ng-packagr to build those. The problem seems isolated to the esm5 packaging of material, which I am guessing not many people are using or else this issue would have much more traffic.
Is there a working example of a project successfully using beta.12’s esm5 packaging anywhere?
Edit: I have another project that is using a custom rollup configuration only building umd and fesm modules successfully with material beta.12, so I really think its an issue specific to the esm5 packaging.