shikijs / twoslash

You take some Shiki, add a hint of TypeScript compiler, and 🎉 incredible static code samples
https://shikijs.github.io/twoslash/
MIT License
1.06k stars 51 forks source link

`remark-shiki-twoslash` inside workspace package incorrectly resolves dependencies #127

Closed vlad-zhukov closed 2 years ago

vlad-zhukov commented 2 years ago

When using remark-shiki-twoslash inside workspace package, it either doesn't resolve dependencies at all or even uses wrong versions. It took me quite some time to debug that remark-shiki-twoslash sets vfsRoot to basically /node_modules/remark-shiki-twoslash/, rather than twoslash`s advertised process.cwd(), which in turn makes TypeScript resolve packages from root rather than current package directory.

The userland fix for this is to set vfsRoot: process.cwd().

But why does it work this way? And can we change it to use the default behaviour?

P.S. Thanks for you work!

orta commented 2 years ago

I feel like I had problems with cwd but I agree that it's probably the right thing to do, want to try send a PR and we'll see how the tests turn out?