Home

Awesome

vite-plugin-replace-lodash

English | 中文

A Vite plugin is used to replace lodash with lodash-es to prevent all lodash modules are imported and the bundle volume is too large because it cannot tree-shaking.

Notice: The lodash-es module needs to be installed separately.

Install

npm:

npm install vite-plugin-replace-lodash

pnpm:

pnpm add vite-plugin-replace-lodash

Usage

import { defineConfig } from 'vite';
import { replaceLodash } from 'vite-plugin-replace-lodash';

export default defineConfig({
  plugins: [replaceLodash()],
})