5

We are receiving this build warning in Angular 10. How can this be fixed? Is there an alternative NPM like Lodash-es ?

hotkeys.js depends on 'mousetrap'. CommonJs and AMD Dependencies can cause optimization bailouts

Error Message

Resource: Upgrading to Angular 10 - Fix CommonJS or AMD dependencies can cause optimization bailouts

1 Answers1

17

This can be fixed by you, if you prefer to contribute to the hotkeys module, by making it ECMAScript compatible.

Or you can just add the module to allowedCommonJsDependencies in your angular.json file as it shown on official documentation.

"build": {
  "builder": "@angular-devkit/build-angular:browser",
  "options": {
     "allowedCommonJsDependencies": [
        "lodash"
     ]
     ...
   }
   ...
},

And finally, you could just ignore the warning until someone makes the module ECMAScript compatible, or use another module with the same functionalities you're looking for.

Ali Demirci
  • 5,302
  • 7
  • 39
  • 66
  • 8
    Not everyone here asking questions is able to contribute to a production library. Maybe if we ask them kindly and teaching, someday they will. – JoeCool Oct 28 '20 at 10:15