nx icon indicating copy to clipboard operation
nx copied to clipboard

fix(vite): resolves files with dot suffixes correctly

Open KonstantinKai opened this issue 1 year ago • 4 comments
trafficstars

Use basename for retrieving the filename in findFile function from nx-tsconfig-paths.plugin that previously led to an unresolved error for files with dot suffixes e.g./dir/file.suffix.ext

Current Behavior

For files that have the same name but one of them has a suffix, e.g.

- lib1
  - file.ts
  - file.i18n.ts
- apps
  - app1
    - main.ts
- tsconfig.base.json // with { "paths": { "@lib1/*": ["lib1/*"] }}

The resolving process is incorrect because the import value from '@lib1/file.i18n' from apps/app1/main.ts every time resolves to file.ts, and the parse method from the node:path splits away the suffix from the name.

Expected Behavior

import value from '@lib1/file.i18n' should work correctly if you import them from another package

Related Issue(s)

Fixes #27852

KonstantinKai avatar Oct 18 '24 12:10 KonstantinKai

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 Dec 12, 2024 5:15pm

vercel[bot] avatar Oct 18 '24 12:10 vercel[bot]

Your CI Pipeline Execution ↗ for commit 1cbeed56c2e854ecd62369b5d7e687c686f85cbd ✅ succeeded.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 57s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 21s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 0s View ↗
nx-cloud record -- nx format:check --base=a0f42... ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 0s View ↗
nx documentation --no-dte ✅ Succeeded 0s View ↗

Last updated at 2024-12-12 20:07:08UTC

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Oct 18 '24 12:10 nx-cloud[bot]

There is some regression. I'm fixing...

KonstantinKai avatar Oct 18 '24 15:10 KonstantinKai

I'm not sure 100%, but I think there was a mistake here when creating the file foo.mts and later importing the file foo.mjs.

KonstantinKai avatar Oct 18 '24 16:10 KonstantinKai

Hello, nx team. Could you provide some feedback about this PR, we really need this fix in our project. I will appreciate this

KonstantinKai avatar Nov 05 '24 16:11 KonstantinKai

same here, need this regression fixed 👍

dvictory avatar Nov 05 '24 23:11 dvictory

Same here! Wondering if this fix will land in the next release :)

roshcagra avatar Nov 11 '24 17:11 roshcagra

Sorry to bug again but this issue is still preventing us from being able to upgrade Nx!

roshcagra avatar Dec 04 '24 15:12 roshcagra

yep, we are on 20.2.2, and this is been a regression since 19.6.6+

dvictory avatar Dec 11 '24 01:12 dvictory

@KonstantinKai @roshcagra @dvictory This has been merged now and should release in a patch soon

Coly010 avatar Dec 12 '24 20:12 Coly010

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[bot] avatar Dec 18 '24 00:12 github-actions[bot]