fwouts / previewjs

Preview UI components in your IDE instantly
https://previewjs.com
Other
1.85k stars 45 forks source link

yarn pnp support #846

Open lodmfjord opened 2 years ago

lodmfjord commented 2 years ago

Is your feature request related to a problem? Please describe. Resolution fails when using preview.js in monorepo with yarn pnp

Describe the solution you'd like Support pnp resolution. For example by using @yarnpkg/esbuild-plugin-pnp. I haven't looked into the code though so I am just guessing.

fwouts commented 2 years ago

Thank you for the pointer to @yarnpkg/esbuild-plugin-pnp :) I'll see what I can do.

fwouts commented 2 years ago

I've looked into this a bit more, it looks like @yarnpkg/esbuild-plugin-pnp is no longer needed because esbuild added support for it (see README).

There are a few bits missing in the rest of the codebase, in particular detecting components seems broken (perhaps because TypeScript Compiler API needs to be set up in a different way?) and virtual files are somehow unable to import packages such as react.

Seeing as pnpm is currently gaining a lot of traction, I'm not sure usage of Yarn PnP will keep growing, so I'm unfortunately going to prioritise other issues due to my limited bandwidth.

Contributions are welcome to fix this of course!

lodmfjord commented 2 years ago

True about yarnpkg/esbuild-plugin-pnp