Angular 10: CommonJs and AMD Dependencies can cause optimization bailouts, hotkeys.js depends on 'mousetrap'

Viewed 12069
1 Answers

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.

Related