Cordobo / angularx-qrcode

A fast and easy-to-use Angular QR Code Generator library with Ivy support
https://cordobo.github.io/angularx-qrcode/
MIT License
469 stars 125 forks source link

Build Warning on Angular10 #120

Closed Qsaws closed 2 years ago

Qsaws commented 3 years ago

We get these warnings on build after an upgrade to Angular10.

WARNING in ../node_modules/angularx-qrcode/fesm2015/angularx-qrcode.js depends on 'qrcode'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Any chance for this to be fixed?

sovushka-utrom commented 3 years ago

Also get this warning for Angular 10:

'qrcode' is not a known element:
1. If 'qrcode' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.ng
Can't bind to 'qrdata' since it isn't a known property of 'qrcode'.ng
gravyplaya commented 3 years ago

As stated in the link in the error code. add the line below to your angular.json "allowedCommonJsDependencies": [ "qrcode" ]

pauloneill commented 3 years ago

I'm getting this issue with both Angular 10 AND 11:

`Error: src/app/jobs/jobs-swing-tag/jobs-swing-tag.component.html:5:13 - error NG8002: Can't bind to 'qrdata' since it isn't a known property of 'qrcode'.

5 <qrcode [qrdata]="'A simple string'" [size]="256" [level]="'M'">


`

I've added the allowedCommonJsDependencies line above and still the same error.

I have created a standalone version but wondered if there's an easy way to determine why this error is occurring without having to compare different projects line by line.... you know, like a debug or verbose switch somewhere?
(the ng serve --verbose command gives me TOO MUCH information to decypher... -_- )

TIA
foramkumar-parekh commented 3 years ago

We get these warnings on build after an upgrade to Angular10.

WARNING in ../node_modules/angularx-qrcode/fesm2015/angularx-qrcode.js depends on 'qrcode'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Any chance for this to be fixed?

Can we have a fix for this, so we do not have to add it into allowedCommonJsDependencies?

stale[bot] commented 3 years ago

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.

Qsaws commented 3 years ago

So no fix in sight?

Cordobo commented 2 years ago

No, this won't be fixed for version <= 10 as there is an easy workaround available.

Please open a new issue with a minimal working app so I may reproduce the issue. Thank you!

MShekow commented 2 years ago

The proposed fix here is a "sweep problem under the rug" work around. The underlying problem is that angularx-qrcode uses qrcode which itself does not support ESM import-mode, and won't do so anytime soon because the core maintainer is not interested in doing it themselves (see corresponding ticket).

Cordobo commented 2 years ago

I commented on the underlying issue here #110 in more detail a while ago