Currently, I am involved in a project that focuses on developing a library. The project includes a lib.ts
file located at the root of the workspace, which outlines all the public exports of the library like this:
export * from "./a/a.ts"
export * from "./b/b.ts"
export * from "./c/c.ts"
During development, I heavily rely on VS Code's autocomplete feature (ctrl + space) to assist with organizing and adding imports automatically. However, an issue arises where Intellisense consistently imports from the lib.ts
file instead of the original source that houses the export definitions.
For example, if a
requires b
, when VS Code auto-organizes the imports in a.ts
, it would look something like this:
import { b } from "../lib"
export const a = b(1)
This setup leads to circular dependencies during build time, causing confusion for tools like rollup
:
lib.ts -> a/a.ts -> lib.ts -> b/b.ts
My question is, is there a way to instruct VS Code to disregard lib.ts
and import b
directly from its original source, as shown below?
import { b } from "../b/b"
export const a = b(1)