[Bug]: Pnpify does not resolve tsconfig's paths in VSCode
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
- I have a Typescript monorepo with nx and yarn PnP
- VSCode is configured according to the documentation using
yarn dlx @yarnpkg/pnpify --sdk vscodeand changing the workspace version to4.2.4-pnpify
Expected
VSCode is able to resolve the typings of external dependencies (e.g. rxjs) and local dependencies (e.g. Nx library, using the tsconfig.json’s paths configuration).
Actual
- VSCode is able to resolve the typings of external dependencies
- VSCode is not able to resolve local dependencies and throws the error
Cannot find module '@issue-yarn-pnp-vscode-nx/foo' or its corresponding type declarations.ts(2307)(see screenshot)
Notes
- However, changing VSCode’s TS version to the default one results in VSCode not able to resolve external dependencies but able to resolve local dependencies
- the problem is only in VSCode because running
yarn nx build bar --with-depsworks and typescript is able to resolve the dependencies
To reproduce
Here is a very simple repo that reproduces the issue https://github.com/micaelmbagira/issue-yarn-pnp-vscode-nx
Environment
System:
OS: macOS 11.4
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Binaries:
Node: 14.16.0 - /private/var/folders/07/fjm413m14h1dwkpqyd0tps5h0000gn/T/xfs-d934ada9/node
Yarn: 2.4.2 - /private/var/folders/07/fjm413m14h1dwkpqyd0tps5h0000gn/T/xfs-d934ada9/yarn
npm: 7.11.2 - ~/.config/yarn/global/node_modules/.bin/npm
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Visual Studio Code can't resolve angular's tsconfig paths
VsCode automatically looks for a tsconfig.json file and it doesn't care about tsconfig.app.json , so paths needs to be specified in tsconfig.
Read more >TypeScript Programming with Visual Studio Code
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It offers classes, modules, and interfaces to help you build robust...
Read more >Tasks in Visual Studio Code
Integrate with External Tools via Tasks. Lots of tools exist to automate tasks like linting, building, packaging, testing, or deploying software systems.
Read more >Visual Studio Code February 0.10.11
To enable JavaScript inside a TypeScript project, you can set the allowJs property to true in the tsconfig.json . Tip: The tsc compiler...
Read more >TypeScript tutorial with Visual Studio Code
You've likely not set "sourceMap": true in your tsconfig.json and the VS Code Node.js debugger can't map your TypeScript source code to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@merceyz I confirm that it works now, thanks, this one will unblock all the Nx users!!
@merceyz when do you plan to release this bugfix?