themyth92 / ngx-lightbox

Lightbox2 use with angular >= 5
MIT License
115 stars 66 forks source link

Getting warning of commonJS #54

Open codoffer opened 4 years ago

codoffer commented 4 years ago

Getting a warning during serve and production

WARNING in /Library/WebServer/Projects/angular/src/app/shared/shared.module.ts depends on ngx-lightbox. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Angular CLI: 10.0.0 Node: 12.14.0 OS: darwin x64 Angular: 10.0.1

GUlbricht commented 4 years ago

The Warnings come from Angular 10, because CommonJS maybe slows down your applications.

Info from the Angular Blog: https://blog.angular.io/version-10-of-angular-now-available-78960babd41

"When you use a dependency that is packaged with CommonJS, it can result in larger slower applications. Starting with version 10, we now warn you when your build pulls in one of these bundles. If you’ve started seeing these warnings for your dependencies, let your dependency know that you’d prefer an ECMAScript module (ESM) bundle."

amreid1993 commented 3 years ago

Is there a way to remove this warning?

santicalvo commented 3 years ago

Hello,

I would also like to get rid of the warning. Is there any way to do it?

Thanks

rqx110 commented 2 years ago

any update on this issue? @themyth92

patrickchoi commented 11 months ago

In angular.json I added ngx-lightbox to allowedCommonJsDependencies and the warning seems to have gone away. It still apparently works

 "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
         "options": {
            "allowedCommonJsDependencies": ["ngx-lightbox"],
            "aot": true,