-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Vitest won't resolve Path aliases in nx 19.7.2, 19.7.1, 19.7.0 and 19.6.6 #27852
Comments
I have the same problem and suspect it might be related to this change, but I don't have the time to confirm this atm: #27774 |
@egonm12 Yes, you are correct. The culprit is
If the file name consists of several segments separated with dots the "parse" will erroneously consider it an extension. For example import { a } from "./app.controller"; controller is obviously not an extension. So #27774 has to be reconsidered. Also, there are other exotic ways to express a path. For example, vite css-pre-processors page advises to use "path.css?inline", hope that doesn't mess the plugin. |
Hi! I'm running into this too while attempting to upgrade to 19.8.2 :( Is there a known workaround or should I wait for a fix before upgrading? |
We also hit this upgrading from 19.6.6 we have in our base tsconfig
this fails
when trying to import file For now we have to stick with 19.6.5 |
concat `ext` with `filename` for parse 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` Closes nrwl#27852
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` <!-- 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 For files that have the same name but one of them has a suffix, e.g. ```ts - 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) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #27852 --------- Co-authored-by: Colum Ferry <[email protected]>
Current Behavior
Vitest will fail with
Error: Failed to load url @test/other-things/things-things.controller (resolved id: @test/other-things/things-things.controller) in /workspace/vitest/apps/vitest-test/src/things/stuff/bla.mapper.spec.ts. Does the file exist? ❯ loadAndTransform ../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-BaOMuo4I.js:51847:17
in 19.6.5 it will run fine tho. Please help because that will halt us from updating.
Expected Behavior
Should resolve Path aliases
GitHub Repo
https://github.com/jahusa02/nx-19.7.0-vitest
Steps to Reproduce
nx test vitest-test
Nx Report
Failure Logs
Package Manager Version
[email protected]
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: