react-doctor/no-full-lodash-import
Import the specific function: `import debounce from 'lodash/debounce'` — saves ~70kb
- Category: Bundle Size
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: always
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Confirm an ImportDeclaration whose source is exactly "lodash" or "lodash-es". The rule fires on both bare default (import _ from "lodash") and named (import { debounce } from "lodash") imports because most bundler setups cannot tree-shake CommonJS lodash; lodash-es is also flagged because misconfigured projects silently bundle the whole package.
Fix prompt
Use this once validation confirms the diagnostic is real.
Switch to per-method paths like import debounce from "lodash/debounce" (or "lodash-es/debounce") to drop roughly 70kb, or replace small helpers with native equivalents (Array.prototype.flat, structuredClone, Object.fromEntries) or the standalone lodash.debounce package. See https://lodash.com/per-method-packages
Related rules
More Bundle Size rules from the rules reference:
react-doctor/no-moment: Replace with `import { format } from 'date-fns'` (tree-shakeable) or `import dayjs from 'dayjs'` (2kb)react-doctor/no-undeferred-third-party: Use `next/script` with `strategy="lazyOnload"` or add the `defer` attributereact-doctor/prefer-dynamic-import: Use `const Component = dynamic(() => import('library'), { ssr: false })` from next/dynamic or React.lazy()react-doctor/use-lazy-motion: Use `import { LazyMotion, m } from "framer-motion"` with `domAnimation` features — saves ~30kbreact-doctor/no-barrel-import: Import from the direct path: `import { Button } from './components/Button'` instead of `./components`