0.2.2 • Published 5 years ago

babel-plugin-lodash-magic-import v0.2.2

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

lodash-magic-import

Greenkeeper badge npmjs downloads CircleCI Coverage Status Climate

Magic import 🍒 picks lodash 📦 for you.

Transforms

import _ from 'lodash';
_.forEach([], () => ({}));

into these

import _forEach from 'lodash/forEach';
_forEach([], () => ({}));

Removes every _ assignment .

So

import _forEach from 'lodash/fp/forEach';

const _ = {
    forEach: _forEach
}

will be removed and replaced.

How to use

> npm i --save lodash
> npm i --save-dev babel-plugin-lodash-magic-import @babel/core @babel/preset-env

.babelrc

{
  "plugins": ["lodash-magic-import"],
  "presets": [["env", { "targets": { "node": true } }]],
}

if you want to use the lodash-magic-cache go for

{
  "plugins": [["lodash-magic-import", { "cache": true }]],
  "presets": [["env", { "targets": { "node": true } }]],
}

and make sure you've

npm i --save lodash-magic-cache

also check out eslint-plugin-lodash-magic-import.

How it differs from babel-plugin-lodash ?

It's much simpler.

We've got a lodash-magic-cache for CommonJS modules caching, and a eslint-plugin-lodash-magic-import for basic compatibility checks.

lodash-magic-import is completely pointless with lodash-es and prohibits usage of Seq and _.chain methods, for the greater good 🎀.

Q&A

Feel free to ask some questions via Discord.

License

Licensed under MIT license, of course.

0.2.2

5 years ago

0.2.1

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago