unplugin / unplugin-vue-components

📲 On-demand components auto importing for Vue
https://www.npmjs.com/package/unplugin-vue-components
MIT License
3.66k stars 341 forks source link

Monorepo usage - supporting of shared components #681

Open AndreiHudovich opened 10 months ago

AndreiHudovich commented 10 months ago

Describe the bug

Trying to make it work in a monorepo powered by Turborepo without building the shared components. There is no much information on the topic.

In the app's vite config (/apps/test-app/vite.config.ts) I do this:

Components({
  dirs: ['src/components', '../../packages/shared/src/components']
})
  1. ../../packages/shared/src/components – this works only on project startup.
  2. When vite is running in dev mode, if you try to add a new component in the packages/shared/src/components, it won't be reflected in components.d.ts of the test-app.

I tried to add the shared components' path in server.fs.allow, but it doesn't work for me.

I attached a minimal reproduction for this issue.

Reproduction

https://github.com/andrei-hudovich/unplugin-vue-components-monorepo-issue

System Info

System:
    OS: macOS 13.4.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 506.21 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.volta/tools/image/node/18.17.1/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
  Browsers:
    Chrome: 116.0.5845.96

Used Package Manager

yarn

Validations