user20002028
user20002028

Reputation:

Lodash imports entire bundle on named imports

Both the lines below are contributing the same size to the bundle.

import _ from "lodash";

import { get } from "lodash";

I am expecting Line-2 to be of less size. ( Refer to the image )

Named imports cost less in Ant Design which is not working in lodash.

Is there a way to reduce this?

enter image description here

Upvotes: 2

Views: 117

Answers (1)

Anjan Talatam
Anjan Talatam

Reputation: 3996

Use default imports

The below line should do the job.

import get from 'lodash/get'

Yes, Ant Design named imports would give you the component you import.

This functionality is yet to be seen in lodash.

Upvotes: 2

Related Questions