TypeError: Cannot read properties of undefined (reading 'version')
I'm getting this error when trying to use in my Vue3 project. Anybody encountered this before?
TypeError: Cannot read properties of undefined (reading 'version') at eval (index.mjs?4c81:15) at Module../node_modules/@vueuse/sound/node_modules/vue-demi/lib/index.mjs (home.js:59) at webpack_require (app.js:854) at fn (app.js:151) at eval (index.js?af75:1) at Module../node_modules/@vueuse/sound/dist/esm/index.js (home.js:35) at webpack_require (app.js:854) at fn (app.js:151) at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Game.vue?vue&type=script&lang=js:3) at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/views/Game.vue?vue&type=script&lang=js (home.js:131)
Basically, what I'm trying to achieve is to play the audio when user clicks 'yes' on the <Modal /> component which emits startGame
Here is the code:
<template>
<Modal @startGame="startGame" />
</template>
<script>
import { useSound } from '@vueuse/sound'
import bgAudio from '@/assets/audio/stranger-things.mp3'
export default {
setup() {
const { play } = useSound(bgAudio)
const startGame = () => {
/* other codes here */
play()
}
return {
startGame
}
}
}
</script>
Having the same issue. I think it is caused by some misconfiguration in vue-demi. I am using Vue ^3.0.0, and having similar error. In Eslint I am getting:
warning in ./node_modules/@vueuse/sound/node_modules/vue-demi/lib/index.mjs "export 'default' (imported as 'Vue') was not found in 'vue'
warning in ./node_modules/@vueuse/sound/node_modules/vue-demi/lib/index.mjs "export 'default' (reexported as 'Vue') was not found in 'vue'
I also encounter this issue on a vue 3 project. Any workaround?
Hey, could you let me know if v2 has fixed this issue for you?