-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Current Behavior
Despite setting up project references using the --workspaces option, Find All References still does not work under the default tsconfig setup.
Expected Behavior
When properly setting up project references, the problems encountered in #3106 should be fixed and Find All References should properly work when using VS Code as an IDE.
GitHub Repo
https://github.com/GautierBlandin/nx-vscode-issue
Steps to Reproduce
- Create an nx workspace using the latest CLI version and using the --workspace to setup project references:
npx create-nx-workspace@latest tsmono --workspaces. To make the reproduction as simple as possible, I chose:
- Stack: node
- Framework: none
- Application name: server
- Generate a dockerfile: no
- Test runner: none
- ESLint: no
- Prettier: no
- CI: skip
- Remote caching: skip
- Create a simple, non-buildable library:
nx g lib libs/mytslib. Options:
- Generator: @nx/js:library
- Linter: none
- Test runner: none
- Update
main.tsin the server app to import from mytslib:
// main.ts
import { mytslib } from "@tsmono/mytslib";
console.log(mytslib());-
Run
nx syncso that the server's tsconfig references the library's tsconfig. -
Close all files in the IDE, and open only libs/mytslib/src/lib/mytslib.ts
-
Restart the typescript server, or restart the IDE
-
Right-click on mytslib, and use the Find All References action. Only one reference will be found (the current file), where two should be (the current file and main.ts).
Nx Report
Node : 23.9.0
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.9.2
nx (global) : 20.0.4
nx : 20.5.0
@nx/js : 20.5.0
@nx/jest : 20.5.0
@nx/eslint : 20.5.0
@nx/workspace : 20.5.0
@nx/devkit : 20.5.0
@nx/esbuild : 20.5.0
@nx/node : 20.5.0
typescript : 5.7.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/js/typescriptFailure Logs
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
Adding "include": ["src/**/*.ts"], to the library's tsconfig.json file seems to fix the problem. However, this means that two tsconfig files now include mytslib.ts. I am not sure of the consequences that this may have, and seems undesirable. However, no amount of tinkering with projects references on my side managed to fix the issue.