babel-plugin-lodash-magic-import

0.2.2 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.2
    0
    • latest

Version History

Package Sidebar

Install

npm i babel-plugin-lodash-magic-import

Weekly Downloads

0

Version

0.2.2

License

MIT

Unpacked Size

41.9 kB

Total Files

5

Last publish

Collaborators

  • void.nugget