admin管理员组文章数量:1291519
I just started a little project using TypeScript, VSCode, and Yarn as my package management tool.
I do not want to globally install TypeScript, preferring to have TypeScript installed in the project only.
I also was trying to use the PnP strategy in Yarn, and according to the docs, I shouldn't expect to see a node_modules
folder.
However, when I try to build my TypeScript files in VSCode, (using Cmd+Shift+B/Ctrl+Shift+B), the command being run is "tsc", which fails since that command is not in my path.
Digging into the VSCode source, it looks like the task provider is hard coded to look for a node_modules folder.
Being relatively new to configuring a project like this, I want to make sure that I'm not missing something obvious. But has anyone else had experience with this setup/configuration to make VSCode use the project's tsc command? Or am I missing a piece of setup somewhere? I was able to craft a custom task that ran yarn tsc
, but I was also considering adding an issue to VSCode to also potentially look in .yarn/sdks/typescript/bin, but I don't feel confident enough in the Yarn side to know if that's a legitimate path that should be considered for the local tsc command.
Now, yes, I'm sure I could flip Yarn into another mode that uses the node_modules folder. And I could switch to using npm (and get the node_modules folder). And I could install typescript globally and get a version of tsc in my PATH. But all of those workarounds seem to imply the default configurations of the tools are illegitimate, which seems wrong and I'd rather see if there's a way to allow a project-installed typescript using yarn's pnp strategy to more easily work out of the box in VSCode.
本文标签:
版权声明:本文标题:visual studio code - Yarn PnP, VSCode, TypeScript, and tsc not found - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736140042a1907523.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论