# esbuild-plugin-lodash

> Similar babel-plugin-lodash for esbuild

Latest version **1.2.0** (published 2022-05-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install esbuild-plugin-lodash
pnpm add esbuild-plugin-lodash
yarn add esbuild-plugin-lodash
bun add esbuild-plugin-lodash
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-05-22 |
| First published | 2021-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Joshua Stephen |
| Maintainers | josteph, joshuastephen |
| Keywords | esbuild, esbuild-plugin, lodash |

## Links

- npm: https://www.npmjs.com/package/esbuild-plugin-lodash
- Repository: https://github.com/josteph/esbuild-plugin-lodash
- Issues: https://github.com/josteph/esbuild-plugin-lodash/issues
- npm.io page: https://npm.io/package/esbuild-plugin-lodash

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2022-05-22
- 1.1.0 — 2021-10-01
- 1.0.4 — 2021-06-26
- 1.0.3 — 2021-05-16
- 1.0.2 — 2021-03-06

## README

# esbuild-plugin-lodash

[![npm](https://img.shields.io/npm/v/esbuild-plugin-lodash.svg)](https://www.npmjs.com/package/esbuild-plugin-lodash)

This plugin is for [esbuild](https://github.com/evanw/esbuild), similar to how [babel-plugin-lodash](https://github.com/lodash/babel-plugin-lodash) works for babel.


## Thoughts

The non-es `lodash` package is not tree-shakeable, this plugin is only for direct import workaround. 

For better coding practices, you can use instead `lodash-es` directly or strictly import the required lodash function manually.


## Installation

```sh
npm install --save-dev esbuild-plugin-lodash
```


## Usage

Define plugin in the `plugins` section of esbuild config like this:

```js
const esbuild = require('esbuild');
const lodashTransformer = require('esbuild-plugin-lodash');

esbuild.build({
  // ...
  plugins: [
    lodashTransformer(),
  ],
})
```

## Result

Having this input file:

```js
import { get, isEmpty }  from 'lodash';

const something = {};

get(something);
isEmpty(something);
```

It will output this following file content:

```js
import get  from 'lodash/get';
import isEmpty  from 'lodash/isEmpty';

const something = {};

get(something);
isEmpty(something);
```

## Options

You can specify your own `filter` as per according to esbuild docs [here](https://esbuild.github.io/plugins/#concepts).

You can specify `outLodashPackage` which by default is `lodash`. An example
of this would be specifying calls to be rewritten to use `lodash-es`.

---
_Source: https://npm.io/package/esbuild-plugin-lodash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
