Cannot find module 'vue-router/auto' or its corresponding type declarations
Closed this issue ยท 17 comments
With version 0.8.x the typings for vue-router/auto disappeared. They don't seem to be part of the unplugin-vue-router/client
that gets added to tsconfig, nor are they present in the typed-router.d.ts anymore
which leands to
:(
what would be caching this do you think ? I created a new project for that reproducible
Thatโs weird but I canโt reproduce it
Can you try with the new version? I still can't reproduce it
I can reproduce of typed-router.d.ts missing the /auto the module after upgrading to 0.8. This was on a project using create vuetify. Steps to reproduce:
- npm create vuetify@latest - At time of writing, this comes with unplugin-vue-router 0.7
- npm run dev - see that vue-router/auto is in d.ts
- update package.json to 0.8
- npm run dev - see that vue-router/auto has disappeared
Only the auto-routes module renamed in 0.8 is generated.
@juw177 there is a client file to add (instructions in changelog)
the template will need to be updated alongside this package
Thanks @posva , yes, I have added "types": ["unplugin-vue-router/client"],
to tsconfig but still didn't work. Strangely, even in the example on the setup page, there is no module called vue-router/auto:
Still nothing with 0.8.4. Not sure if it matters, but I'm using yarn v4 pnp as package manager
I have the same problem have to go back to 7.0.
@Ribeiro-Tiago #118
@juw177 the module declaration was moved to unplugin-vue-router/client, that's why it's not there.
I will be happy to take a look if anybody can provide a reproduction (without yarn pnp ofc)
Setting moduleResolution: Bundler
(+ changes mentioned in changelog) fix it for the vuetify template. I added that to the docs: 76f9392
Thanks @posva , that worked. As for @Ribeiro-Tiago , I think the problem with your confis is you have defined types twice so overwrote the other.
Thanks It was the "moduleResolution": "Bundler" that fix it.
@posva indeed, using "moduleResolution": "Bundler",
does the trick
It does break typing for vuex imports, Could not find a declaration file for module 'vuex'. but this result could not be resolved when respecting package.json "exports". The 'vuex' library may need to update its package.json or typings
, but this seems to be a good enough workaround, and I'll be replacing vuex with pina soon โข๏ธ so doesn't matter much :p
I think Vuex types need to be fixed ๐
For folks who ran into this even with moduleResolution: Bundler
โ try bumping up vue-router
from 4.1 to 4.3. That fixed it for me!
For folks who ran into this even with
moduleResolution: Bundler
โ try bumping upvue-router
from 4.1 to 4.3. That fixed it for me!
This (and none of the previous solutions in this page) was what made it work for me, thank you!