babel-plugin-cjs-modular-lodash

0.0.3 • Public • Published

babel-plugin-cjs-modular-lodash

This is a babel plugin to replace uses of _.method with const _method = require('lodash/method'); _method; to reduce client-side JS bundle sizes.

Assumptions

This plugin assumes that lodash is either available as global._ or has been imported into a file as _.

This plugin will continue to include the entire lodash library (and therefore be rendered mostly useless) if any of the following are used:

const lodash = require('lodash'); // not using _ for lodash const
const { map } = require('lodash'); // destructured import of entire lodash
const fp = require('lodash/fp'); // import of entire lodash/fp

Setup

npm install

Testing

To run jest tests: npm test To run eslint: npm run lint To run lint and tests: npm run lint-and-test

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-cjs-modular-lodash

Weekly Downloads

2

Version

0.0.3

License

ISC

Unpacked Size

8.47 kB

Total Files

13

Last publish

Collaborators

  • quaelin