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.
npm:
npm install vite-plugin-replace-lodash -Dpnpm:
pnpm add vite-plugin-replace-lodash -Dimport { defineConfig } from 'vite';
import { replaceLodash } from 'vite-plugin-replace-lodash';
export default defineConfig({
plugins: [replaceLodash()],
})