Replies: 1 comment
-
Hi Graham!
Islands on the other hand, are each one a separate app (which is why you can use Vue, Svelte, Solid, or Preact). Generally, I'd recommend not to use Vue plugins, and instead leverage the composition API and create a You can still add plugins to Vue islands, though the syntax is more awkward: <script setup lang="ts">
import { getCurrentInstance } from 'vue'
import PosthogPlugin from '~/plugins/posthog' // example
const app = getCurrentInstance().appContext.app
app.use(PosthogPlugin)
</script> I'm not familiar with Posthog, so I'm not sure if this is a viable approach. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm trying to integrate posthog into an Iles site. I made a Vue plugin:
and I use enhanceApp to integrate it:
now I'm trying to add a CookieConsent component which needs to interact with the posthog library. I load it like this:
and it looks like this (simplified):
However, when I try it, I get errors about posthog not being provided:
I can confirm, however, that the plugin is being run, and in the right order. To check that, I added a
console.log
entry to the plugin right before callingapp.provide(posthog)
. I got this output:I've been trying to make this work for a few days now and I'm running out of ideas on how to approach it. Any suggestions? Thank you, and thank you for îles!
Beta Was this translation helpful? Give feedback.
All reactions