I often face an issue with the auto-import feature in VS Code where, upon typing the name of a module that exists both as a local module (or function) and within node_modules
, VS Code’s auto-import feature prefers the version in node_modules
.
For example, when I type cx
and save, the auto-import adds:
import { cx } from "class-variance-authority";
However, I would like it to prioritize and auto-import my local version instead, like so:
import { cx } from "@/app/_utils/cx";
Another example, when I type <Button/> and save, the auto-import adds:
import Button from "@mui/material/Button";
However, I would like the auto-import to add my local version, like so:
import Button from "@/app/components/Button";
If this configuration cannot be achieved directly in VS Code, I would appreciate any recommendations for an extension that could facilitate this.