Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: node does support "import path re-mapping" #17133

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RiskyMH
Copy link
Member

@RiskyMH RiskyMH commented Feb 7, 2025

fixes #4545

@robobun

This comment was marked as off-topic.

In the spirit of treating TypeScript as a first-class citizen, the Bun runtime will re-map import paths according to the [`compilerOptions.paths`](https://www.typescriptlang.org/tsconfig#paths) field in `tsconfig.json`. This is a major divergence from Node.js, which doesn't support any form of import path re-mapping.
In the spirit of treating TypeScript as a first-class citizen, the Bun runtime will re-map import paths according to the [`compilerOptions.paths`](https://www.typescriptlang.org/tsconfig#paths) field in `tsconfig.json`.

This behavior differs from Node.js, which only supports import path re-mapping via the `"imports"` field in `package.json`, and requires that mapped paths [always start with `#`](https://nodejs.org/api/packages.html#subpath-imports).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of highlighting how it's different in Bun, we should highlight how there are two options - using editor-friendly tsconfig.json "paths", or using Node.js-friendly "#imports"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node does support "import path re-mapping"
3 participants