TS Path alias imports not working for spec.ts (the work for .spec.tsx) when using a next project
Current Behavior
As you can see in this screenshot for some reason the typescript config does not like .ts spec files.
Expected Behavior
I should be able to import "@nx-next-ts-issue/my-new-lib" into .ts spec files.
GitHub Repo
https://github.com/vespertilian/nx-next-ts-issue
Steps to Reproduce
NPM install
open example.spec.ts you should see that it does not want to import helloWorld from @nx-next-ts-issue/my-new-lib.
I checked this in both VS Code and Webstorm
Nx Report
Sample REPO
Node : 20.11.1
OS : darwin-arm64
npm : 10.2.4
nx : 19.0.3
@nx/js : 19.0.3
@nx/jest : 19.0.3
@nx/linter : 19.0.3
@nx/eslint : 19.0.3
@nx/workspace : 19.0.3
@nx/devkit : 19.0.3
@nx/eslint-plugin : 19.0.3
@nx/next : 19.0.3
@nx/react : 19.0.3
@nrwl/tao : 19.0.3
@nx/web : 19.0.3
@nx/webpack : 19.0.3
typescript : 5.4.5
---------------------------------------
Registered Plugins:
@nx/next/plugin
@nx/jest/plugin
@nx/eslint/plugin
My repo is a bit older
Node : 20.11.1
OS : darwin-arm64
npm : 10.2.4
nx : 18.2.2
@nx/js : 18.2.2
@nx/jest : 18.2.2
@nx/linter : 18.2.2
@nx/eslint : 18.2.2
@nx/workspace : 18.2.2
@nx/devkit : 18.2.2
@nx/esbuild : 18.2.2
@nx/eslint-plugin : 18.2.2
@nx/next : 18.2.2
@nx/node : 18.2.2
@nx/playwright : 18.2.2
@nx/react : 18.2.2
@nrwl/tao : 18.2.2
@nx/web : 18.2.2
@nx/webpack : 18.2.2
typescript : 5.4.3
### Failure Logs
_No response_
### Package Manager Version
_No response_
### Operating System
- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
### Additional Information
_No response_
It looks like your unit tests are not setup correctly. I remember if you run the config command for vitest or jest it will always regenerate a tsconfig.spec.json file that will include all unit test-like files, including *.spec.ts and *.spec.tsx.
In your reproduction repo the tsconfig.lib.json file is actually excluding all unit test files.
Closing not a Nx issue.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.