cometkim / vite-plugin-relay-lite

Vite plugin for more convenient Relay experience.
MIT License
44 stars 6 forks source link

Compile packages outside of source directory #160

Open hanford opened 1 month ago

hanford commented 1 month ago

Hello! First of all, thanks for creating this package. It's really nice not having to use Babel.

I have a project that's structured as follows:

apps/
    app-1/
    app-2/
    app-3/
packages
    design-system/
    shared-component/
pnpm-workspace.yaml

I'm using Relay in the design system and shared components package from within my apps. My apps, each have their own vite.config.

I would like to be able to run the transform on the packages outside of my source directory. I'm able to achieve it manually manipulating this plugin and commenting out https://github.com/cometkim/vite-plugin-relay-lite/blob/main/src/plugin.ts#L115

I can patch this plugin making my own modifications, but others may want something similar behind a configuration flag. I'm happy to open a PR if that's something we agree makes sense for the plugin.

Let me know what you think, thanks!

cometkim commented 1 month ago

I'm exploring several use cases to make this plugin easier to use in monorepos, thanks for reporting. Will fix soon.

I would prefer to create a new option to allow adding sourceDirectory explicitly.