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

package.json import maps not resolved correctly when it points to a directory under outDir #329

Open
2 tasks
SuperchupuDev opened this issue Sep 30, 2023 · 2 comments
Labels
enhancement New feature or request resolver

Comments

@SuperchupuDev
Copy link

SuperchupuDev commented Sep 30, 2023

Problem

When resolvePackageJsonImports is enabled in tsconfig.json, and they point to somewhere inside the outDir directory, TypeScript will resolve the package import as the same file but inside the rootDir directory.

However tsx does not, it resolves to the original package import directory, making this behavior inconsistent with typescript

This makes something like "imports": { "#*": "./dist/*" } work as expected under TypeScript (point to ./src/*), but makes tsx point to ./dist/*

Expected behavior

tsx having behavior consistent with TypeScript and resolving to the corresponding file inside rootDir

Minimal reproduction URL

https://stackblitz.com/edit/node-9muqn2?file=REPRO-INSTRUCTIONS.md&view=editor

Version

v3.13.0

Node.js version

v20.7.0

Package manager

pnpm

Operating system

Windows

Contributions

  • I plan to open a pull request for this issue
  • I plan to make a financial contribution to this project
@SuperchupuDev SuperchupuDev added bug Something isn't working pending triage labels Sep 30, 2023
@SuperchupuDev SuperchupuDev changed the title package.json import maps not resolved correctly when it points to the same directory as outDir package.json import maps not resolved correctly when it points to a directory under outDir Sep 30, 2023
@SuperchupuDev
Copy link
Author

SuperchupuDev commented Sep 30, 2023

looks like this is a duplicate of #296, however it got closed without resolving

@privatenumber
Copy link
Owner

privatenumber commented Oct 1, 2023

This would be a feature request since TS released this after tsx, and this was simply not implemented.

As it says in the closing comment, #296 was closed as a duplicate, not because it's resolved; the referenced issue is still open.

I think this is a separate issue though. This ticket is about TypeScript customizing Node's import/export map logic to consider tsconfig, whereas #296 is about simply implementing Node's import/export map logic.

@privatenumber privatenumber added enhancement New feature or request resolver and removed bug Something isn't working pending triage labels Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resolver
Projects
None yet
Development

No branches or pull requests

2 participants