Skip to content

Monorepo package exports suggested as relative imports when using re-exported identifiers #284631

@aryzing

Description

@aryzing

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
1.107.0
618725e67565b290ba4da6fe2d29f8fa1d4e3622
arm64
  • OS Version: macOS 15.7.2

Given the following package.json of a package within a monorepo using Bun workspaces,

{
  "name": "@example/shared",
  "type": "module",
  "exports": {
    ".": "./src/index.js"
  },
  "private": true,
  "devDependencies": {
    "@types/bun": "catalog:"
  },
  "peerDependencies": {
    "typescript": "catalog:"
  }
}

VS Code will provide different import suggestions based on the structure of this module:

  • If all of this module's code lives within src/index.ts, attempting to import an identifier from a sibling package will result in VS Code only suggesting @example/shared as the import path.
  • If the package has several files whose identifiers are re-exported from index.ts, VS Code will suggest, in addition to the named import, relative imports to any file (re-)exporting the identifier (e.g., the file the identifier is defined in plus any other intermediate re-exporting index.ts files)

The expected behavior here would be for VS Code to not offer the relative imports.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions