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

Angular optimization warning #110

Closed yktoo closed 4 years ago

yktoo commented 4 years ago

Angular compiler gives the following warning:

WARNING in .../node_modules/angularx-qrcode/__ivy_ngcc__/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

Is there anything to do about that?

Cordobo commented 4 years ago

Hi @yktoo ,

thanks for your comment, unfortunately there is an open issue in the underlying lib qrcode.

The good news is, this is not a big problem, for now it's a warning that your bundle might have some extra bytes. It will work as expected and won't break.

If you want to get rid of the warning, you can add the following to your angular.json:

"build": {
  "builder": "@angular-devkit/build-angular:browser",
  "options": {
     "allowedCommonJsDependencies": [
        "angularx-qrcode",
        "qrcode",
     ]
     ...
   }
   ...
},
mahadihanif commented 2 years ago

add the following to your angular.json:

"allowedCommonJsDependencies": [ "angularx-qrcode", "qrcode", "@cordobo/qrcode" ],

Cordobo commented 1 year ago

^^this is now obsolete, as the latest release is re-using the original node-qrcode package.

yktoo commented 1 year ago

Indeed, all what's needed as of angularx-qrcode 15.x is:

"allowedCommonJsDependencies": ["qrcode"],