Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick lodash to decrease bundle size? #195

Open
MicroBenz opened this issue Mar 24, 2019 · 3 comments
Open

Cherry pick lodash to decrease bundle size? #195

MicroBenz opened this issue Mar 24, 2019 · 3 comments

Comments

@MicroBenz
Copy link
Contributor

I've seen that this project is using lodash. Maybe it will better to use lodash with "cherry pick" import to reduce the bundle size.

For example instead of using

import _ from 'lodash'
_.random()

Use this instead

import random from 'lodash/random'
@kristw
Copy link
Collaborator

kristw commented Mar 24, 2019

Can also use import { random } from 'lodash' and use babel-plugin-lodash

@MicroBenz
Copy link
Contributor Author

Yesterday, I tried to add gatsby-lodash-plugin main problem is they don't allow us to use _.chain. So we need to change it to _.compose instead.

@kristw
Copy link
Collaborator

kristw commented Mar 25, 2019

Use flow instead of _.chain krub and other functions from lodash/fp instead of lodash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants