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): tsconfig paths plugin should not partially match paths #29501

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

mattlewis92
Copy link
Contributor

Current Behavior

When there is a path mapping like:

"match-lib-deep/": ["libs/lib1/src/*"],
"match-lib-top-level": ["libs/lib2/src/*"],
"match-lib/*": ["libs/lib3/src/*"],

Imports to match-lib-deep or match-lib-top-level will try and use the last match-lib path mapping as the trailing / is not accounted for in the startsWith check.

Expected Behavior

The correct path mapping is matched.

Related Issue(s)

N/A

@mattlewis92 mattlewis92 requested a review from a team as a code owner January 2, 2025 16:13
Copy link

vercel bot commented Jan 2, 2025

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

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jan 2, 2025 4:15pm

Copy link

nx-cloud bot commented Jan 2, 2025

View your CI Pipeline Execution ↗ for commit 89f15a8.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 28m 5s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 1m 1s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx format:check --base=8a841... ✅ Succeeded 20s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 19s View ↗
nx documentation --no-dte ✅ Succeeded 39s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-02 16:50:10 UTC

Copy link
Member

@leosvelperez leosvelperez left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!

@leosvelperez leosvelperez merged commit 6948249 into nrwl:master Jan 7, 2025
6 checks passed
FrozenPandaz pushed a commit that referenced this pull request Jan 7, 2025
…9501)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

When there is a path mapping like:
```
"match-lib-deep/": ["libs/lib1/src/*"],
"match-lib-top-level": ["libs/lib2/src/*"],
"match-lib/*": ["libs/lib3/src/*"],
```

Imports to `match-lib-deep` or `match-lib-top-level` will try and use
the last `match-lib` path mapping as the trailing `/` is not accounted
for in the `startsWith` check.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The correct path mapping is matched.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

N/A

(cherry picked from commit 6948249)
Copy link

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 Jan 13, 2025
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.

2 participants