vueuse / sound

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

Could not find a declaration file for module '@vueuse/sound' #42

Open RaffaeleSgarro opened 1 year ago

RaffaeleSgarro commented 1 year ago

I have the following compilation error when running npm run build in a fresh Vue app:

src/App.vue:21:26 - error TS7016: Could not find a declaration file for module '@vueuse/sound'. 'C:/[...redacted...]/node_modules/@vueuse/sound/dist/index.mjs' implicitly has an 'any' type.
  There are types at 'C:/[...redacted...]/node_modules/@vueuse/sound/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@vueuse/sound' library may need to update its package.json or typings.

21 import { useSound } from '@vueuse/sound';
                            ~~~~~~~~~~~~~~~

Found 1 error in src/App.vue:21

ERROR: "type-check" exited with 2.

The error goes away if I manually delete the exports key in package.json:

  "exports": {
    ".": {
      "require": "./dist/index.cjs",
      "import": "./dist/index.mjs"
    },
    "./nuxt": {
      "require": "./dist/nuxt.cjs",
      "import": "./dist/nuxt.mjs"
    }
  },

Do you have any clue to solve it?

RaffaeleSgarro commented 1 year ago

If it works for you it's a valid workaround. Otherwise I published a forked build:

https://www.npmjs.com/package/@raffaelesgarro/vue-use-sound

oliver139 commented 1 year ago

Oops, mine is not working and thanks for your build!