In Angular when using a CommonJS dependency like moment one gets a warning like CommonJS or AMD dependencies can cause optimization bailouts. For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies Following this link to the official angular docs we can see that we can specify these dependencies in a special field in the build section: "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "allowedCommonJsDependencies": [ "lodash" ] … } … }, Then the warning is gone. However when we develop a library which uses a CommonJs dependency I did not find any setting in ngPackagr to do this. This results in the same warning for consumers of the library. Is there any possibility to set allowedCommonJsDependencies in ngPackagr? Continue reading...