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.