henk-badenhorst / vue-hotjar

A NPM package to easily integrate Hotjar to any Vue 2 Project
https://www.npmjs.com/package/vue-hotjar
MIT License
27 stars 3 forks source link

Vue 3 Compatibility #16

Closed mjwilson94 closed 3 years ago

mjwilson94 commented 3 years ago

Hi,

I was wondering if you were thinking of updating the package to support Vue3?

I get the error:

main.js

app.use(Hotjar, {
    id: "XXXXXXX",
    isProduction: true
  });

error

vue-hotjar.js:4 Uncaught TypeError: Cannot set property '$hj' of undefined
    at Object.install (vue-hotjar.js:4)
    at Object.use (vue.js:4091)
    at main.js:32

Thanks,

henk-badenhorst commented 3 years ago

Hi, Thanks for reporting. I am aware of this issue and working on a fix for this. There are a few challenges I need to overcome, specifically with Vue 3 and TypeScript but I should have a fix soon for this. I'll be sure to keep you posted.

mjwilson94 commented 3 years ago

Thanks very much - appreciate all the work on this! I'll eagerly await the update

henk-badenhorst commented 3 years ago

Hi @mjwilson94, I have resolved your compatibility with Vue 3. However, if you are using typescript with Vue 3 this will still break due to the interface changes in Vue 3. I also had to remove the ability to interact with the Hotjar API for Vue 3 users. However, Vue 2 users are unaffected by this change. See the update in the readme.md under the heading Hotjar API.

I have spent quite some time trying to figure out how to make this plugin fully compatible with Vue 3 including typescript. But in the end, the cleanest option will be to create a new npm package. I have started work on vue-hotjar-next I will be ready with this in a few weeks but hopefully this update in version 1.3.0 will solve your issues. Please let me know if this resolves your issue.

henk-badenhorst commented 3 years ago

Hi @mjwilson94, I am closing this issue. I have released a new version specifically for Vue 3 her is the link: vue-hotjar-next