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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8b6a517 · Nov 20, 2024

History

6 Commits
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024
Nov 20, 2024

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