# Jsonforms uses lodash which causes "optimization bailouts" (angular)

**URL:** https://jsonforms.discourse.group/t/jsonforms-uses-lodash-which-causes-optimization-bailouts-angular/777
**Category:** General
**Created:** [May 23, 2022, 2:29pm UTC](https://jsonforms.discourse.group/t/jsonforms-uses-lodash-which-causes-optimization-bailouts-angular/777 "2022-05-23T14:29:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![derdeka](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/derdeka/32/331_2.png) [@derdeka](https://jsonforms.discourse.group/u/derdeka)
#### Post date: [May 23, 2022, 2:29pm UTC](https://jsonforms.discourse.group/t/jsonforms-uses-lodash-which-causes-optimization-bailouts-angular/777/1 "2022-05-23T14:29:33Z")

</div>

Hi,

I’m using Angular 13.3.7 with @jsonforms/angular and @jsonforms/angular-material version 3.0.0-beta.2

In the logs i’ve tons of “bailout” warnings caused by jsonforms and its dependencies. How to optimize the import of this external dependencies?

```auto
Warning: node_modules\@jsonforms\angular-material\ __ivy_ngcc__ \lib\esm\other\master-detail\master.js depends on 'lodash/get'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\angular-material\ __ivy_ngcc__ \lib\esm\other\master-detail\master.js depends on 'lodash/some'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\angular-material\ __ivy_ngcc__ \lib\esm\other\object.renderer.js depends on 'lodash/isEmpty'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\angular-material\ __ivy_ngcc__ \lib\esm\other\object.renderer.js depends on 'lodash/startCase'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\angular\ __ivy_ngcc__ \lib\esm\abstract-control.js depends on 'lodash/merge'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\angular\ __ivy_ngcc__ \lib\esm\jsonforms-root.component.js depends on 'ajv'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\angular\ __ivy_ngcc__ \lib\esm\jsonforms.component.js depends on 'lodash/maxBy'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'ajv-formats'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/cloneDeep'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/endsWith'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/filter'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/find'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/fp/set'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/has'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/includes'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/isEqual'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/isFunction'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/keys'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/range'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/reduce'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/remove'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/toPairs'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: node_modules\@jsonforms\core\lib\jsonforms-core.esm.js depends on 'lodash/union'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

```

---

<div class="post-metadata">

### Author: ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)
#### Post date: [May 23, 2022, 3:08pm UTC](https://jsonforms.discourse.group/t/jsonforms-uses-lodash-which-causes-optimization-bailouts-angular/777/2 "2022-05-23T15:08:10Z")

</div>

Hi @derdeka,

we only use specialized imports e.g. `import isEmpty from 'lodash/isEmpty'` which is basically manual treeshaking. You can therefore ignore these warnings. There is an option (i.e. `allowedCommonJsDependencies: ["lodash"]`) which can be handed over to the builder.

I did not try it myself but you should also be able to alias `lodash` to `lodash-es` via webpack. So if you try to go this route please report 😉

---

<div class="post-metadata">

### Author: ![alastair-todd](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/alastair-todd/32/160_2.png) [@alastair-todd](https://jsonforms.discourse.group/u/alastair-todd)
#### Post date: [July 5, 2025, 6:12am UTC](https://jsonforms.discourse.group/t/jsonforms-uses-lodash-which-causes-optimization-bailouts-angular/777/3 "2025-07-05T06:12:02Z")

</div>

Hey its now 2025 and jsonforms is still not using lodash esm.

`allowedCommonJsDependencies` only masks the problem by hiding the warning. We wants tree-shaking!

It is required to specifically use the lodash-es module (it has @types)

`import { pickBy } from 'lodash-es';`

Then we wont see all this noise

---

<div class="post-metadata">

### Author: ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)
#### Post date: [July 7, 2025, 7:38am UTC](https://jsonforms.discourse.group/t/jsonforms-uses-lodash-which-causes-optimization-bailouts-angular/777/4 "2025-07-07T07:38:30Z")

</div>

Hi @alastair-todd,

We’re fine with switching to `lodash-es`. Do you want to contribute this change?
