Skip to content

Instantly share code, notes, and snippets.

@bn-l
Last active February 10, 2017 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bn-l/c1a336755539fea85868a14ef3192f0d to your computer and use it in GitHub Desktop.
Save bn-l/c1a336755539fea85868a14ef3192f0d to your computer and use it in GitHub Desktop.
Importing only needed components from lodash

Keeping your bundle small

If you're concerned about the extra weight that lodash will add to your bundle you can install babel-plugin-lodash

npm install --save-dev babel-plugin-lodash

and add it to your .babelrc

{
  "presets": // es2015, stage-whatever
  "plugins": [/* other plugins */, "lodash"]
}

this way you can do modular imports, and reduce the size of your bundles on the frontend

import { map, take, sortBy } from 'lodash/fp'

From: https://github.com/AriaFallah/mobx-store

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment