Albert Rannetsperger
Albert Rannetsperger

Reputation: 934

Vue 3 local component library (sfc) development not working due to Plugins not reloading

I need help. I'm developing a vue-3 (Quasar/Electron) app with a separate component library. What I'm trying to get working is to develop the component library locally alongside the main app with hot reload.

It's pretty simple, I already have the component library configured as a Vue plugin. If I push to NPM and add it to my project as an npm dependency, everything works fine. What doesn’t work is when I use yarn link to symlink locally and then add it the same way:

import { MyComponentLib } from 'my-component-lib';

app.use(MyComponentLib);

This worked fine on vue-2 as any changes to the local component lib would get reloaded and immediately shown during development. However with vue-3, you can only load a plugin once (even in development). After the first load you will get a warning: "[Vue warn]: Plugin has already been applied to target app.".

You basically need to restart the app everytime to see changes to your local component library. Does anyone know how to get around this?

Upvotes: 3

Views: 2550

Answers (1)

Jose Alfonso
Jose Alfonso

Reputation: 41

Setup your project with pnpm workspaces. it will make your life easier. https://pnpm.io/workspaces

Upvotes: 0

Related Questions