WARNING in /../node_modules/ng2-pdf-viewer/__ivy_ngcc__/fesm2015/ng2-pdf-viewer.js depends on pdfjs-dist/build/pdf. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
same here
same here, but put in angular.json like they said in official guide
[https://angular.io/guide/build#configuring-commonjs-dependencies]
"options": {
"allowedCommonJsDependencies": [",
"moment-business",
"ng2-pdf-viewer",
"pdfjs-dist/build/pdf",
"pdfjs-dist/web/pdf_viewer"
],
this is just for ignoring the warnings. But the goal should be to get rid of the warnings in general.
Ignoring errors is not the way to go.
same here, any news?
pdfjs is not written with es modules, but they made a es module wrapper available that could be used in the meantime: https://www.npmjs.com/package/@bundled-es-modules/pdfjs-dist
for more info: https://github.com/mozilla/pdf.js/issues/10317
@saithis thanks for pointing the right issue
@bundled-es-modules/pdfjs-dist seems to be outdated
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Can we re-open this one?
@mrmokwa yes indeed
any news?
I hate this Warning :'(
Any updates?
Any updates on this?
This warning is really annoying any pending fixes for this yet?
I m able to fix the issue by adding commonJsdependency property in the angular.json
angular.json
Inside Build command there is an option
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["ng2-pdf-viewer"],
}
I m able to fix the issue by adding commonJsdependency property in the angular.json
angular.json
Inside Build command there is an option
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": ["ng2-pdf-viewer"],
}
this is not a fix, this is an ignore.
@VadimDez When I tried to build you library from source, I ran into the same problem. Even worse: the require() statements work in the ng2-pdf-viewer demo project, but they failed to work after copying the dist folder to my test project.
Can we get rid of the require() statements? Angular's stopped supporting require.js. It'd be nice to use an import statement instead. Or we could load pdf.js and viewer.js directly. That'd allow for loading these big files lazily.
any updates?
Most helpful comment
this is just for ignoring the warnings. But the goal should be to get rid of the warnings in general.