Skip to content

Replacing the import of lodash with lodash-es is more beneficial to tree-shaking

License

Notifications You must be signed in to change notification settings

mingtianyihou33/vite-plugin-replace-lodash

Repository files navigation

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()],
})

About

Replacing the import of lodash with lodash-es is more beneficial to tree-shaking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published