vueuse / sound

🔊 A Vue composable for playing sound effects
https://sound.vueuse.org
MIT License
482 stars 26 forks source link

Not working with Vue3 & Vite3 #27

Open ozgurozalp opened 2 years ago

ozgurozalp commented 2 years ago

I only get the error in the image

image

tunghsingw commented 2 years ago

same problem

mentalrob commented 2 years ago

same problem

mirzobedil commented 1 year ago

same problem

HamasakiBrain commented 1 year ago

same problem

DanielMontilla commented 1 year ago

same problem

Tahul commented 1 year ago

Hey @ozgurozalp & @tunghsingw 🙂

I'm very sorry I took so long to answer and fix this issue!

Could you let me know if v2 fixed it for you? I successfully run it with latest Vite and Nuxt 3!

P-James commented 1 year ago

When using a fresh Vite / Vue 3 app (created with Vite CLI). I get the error: HowlConstructor.value is not a constructor image

I forked and tried editing line 27 on index.ts from HowlConstructor.value = howler.Howl to HowlConstructor.value = howler.default.Howl, but then I get the same warning mentioned above

image

P-James commented 1 year ago

After some more tinkering, importing onMounted from 'vue' instead of 'vue-demi' fixed the problem. Is this potentially a Vue bug? I thought they're meant to interact seamlessly 🤔

On index.ts line 2: import { onMounted, ref, unref, watch } from 'vue'

Edit: have made a PR with some more info https://github.com/vueuse/sound/pull/29