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

fix(vite): deep file resolution in nx-tsconfig-paths.plugin.ts #21513

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

ianchadwick
Copy link
Contributor

Deep file resolution fails when trying to use tsconfig paths like:

"paths": {
"@org/sdk/": ["libs/sdk/src/lib/"],
}

And importing:

import thing from '@org/sdk/thing';

TS is happy with this but vite fails to resolve.

I could be missing something but the original code doesn't actually use tsconfig.absoluteBaseUrl so path resolution fails as the relative path is used.

Current Behavior

Deep file resolution fails when trying to use tsconfig paths like:

"paths": {
  "@org/sdk/*": ["libs/sdk/src/lib/*"],
}

And importing:

import thing from '@org/sdk/thing';

TS is happy with this but vite fails to resolve the file.

Expected Behavior

The import path should be resolved taking into account the project structure.

Fixes #21512

@ianchadwick ianchadwick requested a review from a team as a code owner February 2, 2024 02:57
Copy link

vercel bot commented Feb 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Feb 2, 2024 4:02pm

@mandarini mandarini self-assigned this Feb 2, 2024
@mandarini mandarini changed the title fix(nx) deep file resolution in nx-tsconfig-paths.plugin.ts fix(vite): deep file resolution in nx-tsconfig-paths.plugin.ts Feb 2, 2024
@mandarini mandarini enabled auto-merge (squash) February 2, 2024 16:01
@mandarini mandarini enabled auto-merge (squash) February 2, 2024 16:05
@mandarini mandarini merged commit 9a9bd2a into nrwl:master Feb 2, 2024
6 checks passed
FrozenPandaz pushed a commit that referenced this pull request Feb 2, 2024
FrozenPandaz pushed a commit that referenced this pull request Feb 3, 2024
Copy link

github-actions bot commented Feb 8, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nxViteTsPaths fails to resolve deep file resolution.
3 participants