-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt 3 failed to resolve import "../../../index" from useSound in runtime #30
Comments
@Tahul I have exactly the same error. If I manually add When building the module the dist folder already gives these errors |
Seems like this issue is now resolved with the latest update |
@ThimoDEV The issue is to do with the auto import is that right? I'm still getting the same issue if using auto import so I'll keep this open. It's not possible to use auto imports for this? |
I also get a "TypeError: Cannot read properties of undefined (reading 'Howl')" with the latest update after using module "@vueuse/sound/nuxt" and manually importing useSound, no sounds playing in development |
It still doesn't play sounds for me neither, However the errors I got earlier are gone in Nuxt now (useSound import error). I made a new issue to see what could be the problem nuxt related (or maybe also for vite) |
It hasn't been fixed yet. |
Issue is due compiled files ending up in Temporary fixEnsure you're using the Nuxt module, and you've set // nuxt.config.ts
export default defineNuxtConfig({
modules: [
...
"@vueuse/nuxt",
"@vueuse/sound/nuxt",
],
sound: {
sounds: {
scan: true,
},
},
vite: {
optimizeDeps: {
include: ["howler"],
},
},
...
}); Put the following inside diff --git a/dist/runtime/composables/use-sound.ts b/dist/runtime/composables/use-sound.ts
index e1dfc0944295c0aa7915b9a4fc047c1ec51fb084..c2a3c7a9ad7730bf32c29229bc214c6db10efbfa 100644
--- a/dist/runtime/composables/use-sound.ts
+++ b/dist/runtime/composables/use-sound.ts
@@ -1,5 +1,5 @@
import type { ComposableOptions } from '../../../types'
-import { useSound as _useSound } from '../../../index'
+import { useSound as _useSound } from '../../index'
import type { SoundsPaths } from '#build/sounds/types'
import { useNuxtApp } from '#imports' Then add the following to the end of your "pnpm": {
"patchedDependencies": {
"@vueuse/[email protected]": "patches/@[email protected]"
}
} Ensure you're shamefully hoisting. Add the following to
And finally run Here's a snippet of usage. // public/sounds/background.mp3
const { play, pause, stop } = useSound("/sounds/background.mp3"); It seems like auto import scanning for type generation doesn't work, but I've yet to investigate that. I don't understand enough about library building yet to submit a PR to fix this atm though. If anyone could point me in the right direction, or use this info to submit a PR that'd be fantastic! :) |
Hello! I was trying to use this module for nuxt 3, but it does not seem able to find some of the files, maybe it needs to be restructured so that it can find the file after being installed as a node module?
The text was updated successfully, but these errors were encountered: