ElMassimo / iles

🏝 The joyful site generator
https://iles.pages.dev
MIT License
1.06k stars 31 forks source link

Unable to apply client directive when using Vuetify #259

Closed TechAkayy closed 10 months ago

TechAkayy commented 10 months ago

Description 📖

I'm using Vuetify, and the SampleCard component in the index page loads fine in development before adding client directives. But when I add client:load to SampleCard, vuetify breaks with this error message.

I notice a slight flash of the component loading fine, before it disappears and displays the below error.

image

Reproduction 🐞

https://github.com/pinegrow/pg-iles-vuetify

Dependencies Info _Run `npx iles info` and `pnpm list` (or `npm list`) and provide the output:_ ``` iles v0.9.5 vite v4.3.9 ```

Screenshots 📷

ElMassimo commented 10 months ago

Hi!

Based on the error message, it seems like Vuetify is relying on global injects, requiring its plugin to be added in the Vue app in order for Vuetify components to work.

Since client:load will run the component in a separate Vue app, you might need to use the plugin provided by Vuetify inside the island, see related discussion.

TechAkayy commented 10 months ago

Awesome, thanks @ElMassimo. That makes sense. import { getCurrentInstance } from 'vue' is a new learning for me :-)

TechAkayy commented 10 months ago

Works nicely now 👍 https://pg-iles-vuetify.netlify.app/ Thanks.