@digitalmaas/esbuild-plugin-lodash
v1.0.0
Published
An esbuild plugin for `lodash` transformation
Downloads
22
Maintainers
Readme
Esbuild Lodash Transform Plugin
Installation
npm install @digitalmaas/esbuild-plugin-lodash --save-dev
Setup
import esbuild from 'esbuild'
import { transformLodashPlugin } from '@digitalmaas/esbuild-plugin-lodash'
await esbuild.build({
/* all of your config */,
plugins: [
transformLodashPlugin({ /* options */ }),
]
})
Usage
Having this input file:
import { get, isEmpty } from 'lodash'
const something = {}
get(something)
isEmpty(something)
It will output this following file content:
import get from 'lodash/get.js'
import isEmpty from 'lodash/isEmpty.js'
const something = {}
get(something)
isEmpty(something)
Options
filter: RegExp
You can specify your own filter
as per according to esbuild docs here. Defaults to /\.(js|cjs|mjs|ts|cts|mts|tsx)$/
.
namespace: string
You can specify your own namespace
as per according to esbuild docs here.
appendJsExtension: boolean
If true
, the plugin will append .js
to the end of CommonJS lodash imports. Defaults to true
.
outputLodashPackage: string
Specifies lodash package to use in output. Can be either lodash
or lodash-es
. Defaults to lodash
.
More Info
- https://esbuild.github.io/
- https://lodash.com/
License
MIT License.
Complete license in ./LICENSE file.