Eui: Say no - to lodash

Created on 1 Feb 2018  路  6Comments  路  Source: elastic/eui

Get rid of lodash dependency!

engineer chore good first issue skip-stale-check

All 6 comments

Is the impetus to remove lodash just bundle size or is there more to it than that?

Bundle size and limiting number & scope of external dependencies.

I started looking into this today, and would like to help out. As a starting point, would it be suitable to open a PR which changes a couple of lodash imports as shown below?

# current
import _ from 'lodash'
import { utilA, utilB } from 'lodash'

# proposed
import utilA from 'lodash/utilA'
import utilB from 'lodash/utilB'

Although the approach I'm proposing here is a bit repetitive, my understanding is that it enables Webpack to bundle-split lodash. When I perform bundle analysis on my current application (which consumes eui), it appears the entire lodash library is included. This guide, and this summary post led me to make this suggestion, though I'm unsure if other webpack configuration changes would be required.

It appears that these two modules would need to change:

https://github.com/elastic/eui/blob/52c326bd8c66d18ecf93ae11087ff3997b23a83c/src-docs/src/views/collapsible_nav/collapsible_nav_all.tsx#L2

https://github.com/elastic/eui/blob/52c326bd8c66d18ecf93ae11087ff3997b23a83c/src/components/token/token.tsx#L21

Getting rid of lodash completely would also be good. My idea is to use this as a low-risk stepping stone towards that. 馃槃

Removing lodash completely is the goal. Replacing each instance of its use in small batches - either by file by lodash method - will likely be the easiest way for us to review.

Awesome, I'll likely make that contribution at the start of next week 馃槃

馃憢 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

Was this page helpful?
0 / 5 - 0 ratings