Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is there a way to reduce this?

lodash import statements

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading