Skip to content

Commit 9c1c7da

Browse files
authored
deps: Consistently use deep lodash imports to allow proper tree-shaking
Instead of importing top-level module, consistently use deep-imports for lodash. This allows projects to properly tree-shake lodash in their build which substantially reduces the size of the resulting bundle.
1 parent 21400a8 commit 9c1c7da

File tree

7 files changed

+8
-7
lines changed

7 files changed

+8
-7
lines changed

packages/angular-material/src/library/other/object.renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
setReadonly,
4141
UISchemaElement,
4242
} from '@jsonforms/core';
43-
import { cloneDeep } from 'lodash';
43+
import cloneDeep from 'lodash/cloneDeep';
4444

4545
@Component({
4646
selector: 'ObjectRenderer',

packages/angular/src/library/jsonforms.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ import { JsonFormsBaseRenderer } from './base.renderer';
4848
import { JsonFormsControl } from './control';
4949
import { JsonFormsAngularService } from './jsonforms.service';
5050

51-
import { get, isEqual } from 'lodash';
51+
import isEqual from 'lodash/isEqual';
52+
import get from 'lodash/get';
5253

5354
const areEqual = (
5455
prevProps: StatePropsOfJsonFormsRenderer,

packages/angular/src/library/jsonforms.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import {
5050
import { BehaviorSubject, Observable } from 'rxjs';
5151
import type { JsonFormsBaseRenderer } from './base.renderer';
5252

53-
import { cloneDeep } from 'lodash';
53+
import cloneDeep from 'lodash/cloneDeep';
5454
import type Ajv from 'ajv';
5555
import type { ErrorObject } from 'ajv';
5656

packages/core/src/mappers/renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ import {
8585
} from '../store';
8686
import { isInherentlyEnabled } from './util';
8787
import { CombinatorKeyword } from './combinators';
88-
import { isEqual } from 'lodash';
88+
import isEqual from 'lodash/isEqual';
8989

9090
const move = (array: any[], index: number, delta: number) => {
9191
const newIndex: number = index + delta;

packages/core/src/reducers/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import {
4444
} from '../actions';
4545
import { JsonFormsCore, Reducer, ValidationMode } from '../store';
4646
import Ajv, { ErrorObject } from 'ajv';
47-
import { isFunction } from 'lodash';
47+
import isFunction from 'lodash/isFunction';
4848
import { createAjv, validate } from '../util';
4949

5050
export const initState: JsonFormsCore = {

packages/examples/src/examples/arraysI18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
import { registerExamples } from '../register';
2626
import { ArrayTranslationEnum, Translator } from '@jsonforms/core';
27-
import { get } from 'lodash';
27+
import get from 'lodash/get';
2828

2929
export const schema = {
3030
type: 'object',

packages/vue-vanilla/src/complex/ObjectRenderer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
useJsonFormsControlWithDetail,
3232
} from '../../config/jsonforms';
3333
import { useVanillaControl } from '../util';
34-
import { isEmpty } from 'lodash';
34+
import isEmpty from 'lodash/isEmpty';
3535
3636
const controlRenderer = defineComponent({
3737
name: 'ObjectRenderer',

0 commit comments

Comments
 (0)