0.2.0 • Published 1 year ago

unplugin-lodash-to-lodashes v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

unplugin-lodash-to-lodashes

Replace lodash with lodash-es, support use in vite, webpack

Installation

npm i unplugin-lodash-to-lodashes
// vite.config.ts
import lodashToLodashes from 'unplugin-lodash-to-lodashes/vite';

export default defineConfig({
  plugins: [
    lodashToLodashes({ /* options */ }),
  ],
})

const lodashToLodashes = require('unplugin-lodash-to-lodashes/webpack');

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    lodashToLodashes({ /* options */ }),
  ],
}

Usage

It will automatically transform:

import isNull from 'lodash/isNull'
const isNumber = require('lodash/isNumber');

//    ↓ ↓ ↓ ↓ ↓ ↓

import isNull from 'lodash-es/isNull'
const isNumber = require('lodash-es/isNumber.js').default;

Options

lib

type Lib = string

default: lodash-es

// lib: '../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es'
import isNull from 'lodash/isNull'
const isNumber = require('lodash/isNumber');


//    ↓ ↓ ↓ ↓ ↓ ↓

import isNull from '../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isNull'
const isNumber = require('../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isNumber.js').default;
0.2.0

1 year ago

0.1.2-beta.1

1 year ago

0.1.2-beta.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago