Skip to content
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

Cannot find module 'vue-router/auto' or its corresponding type declarations #323

Closed
Ribeiro-Tiago opened this issue Feb 22, 2024 · 17 comments

Comments

@Ribeiro-Tiago
Copy link

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

Screenshot 2024-02-22 at 16 04 53

which leands to

Screenshot 2024-02-22 at 16 04 11

repo: https://github.com/Ribeiro-Tiago/repro-repo

@posva
Copy link
Owner

posva commented Feb 22, 2024

I cannot reproduce, I get the same issue as #322. You might have hit a cache issue?

@posva posva closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2024
@Ribeiro-Tiago
Copy link
Author

:(

what would be caching this do you think ? I created a new project for that reproducible

Copy link
Owner

posva commented Feb 22, 2024

That’s weird but I can’t reproduce it

@posva
Copy link
Owner

posva commented Feb 24, 2024

Can you try with the new version? I still can't reproduce it

@juw177
Copy link

juw177 commented Feb 25, 2024

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:

  1. npm create vuetify@latest - At time of writing, this comes with unplugin-vue-router 0.7
  2. npm run dev - see that vue-router/auto is in d.ts
  3. update package.json to 0.8
  4. npm run dev - see that vue-router/auto has disappeared

Only the auto-routes module renamed in 0.8 is generated.

@posva
Copy link
Owner

posva commented Feb 26, 2024

@juw177 there is a client file to add (instructions in changelog)

the template will need to be updated alongside this package

@juw177
Copy link

juw177 commented Feb 26, 2024

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:

image

@Ribeiro-Tiago
Copy link
Author

Still nothing with 0.8.4. Not sure if it matters, but I'm using yarn v4 pnp as package manager

@lfhenrl
Copy link

lfhenrl commented Feb 26, 2024

I have the same problem have to go back to 7.0.

@posva
Copy link
Owner

posva commented Feb 26, 2024

@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)

@posva
Copy link
Owner

posva commented Feb 26, 2024

Setting moduleResolution: Bundler (+ changes mentioned in changelog) fix it for the vuetify template. I added that to the docs: 76f9392

@juw177
Copy link

juw177 commented Feb 26, 2024

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.

@lfhenrl
Copy link

lfhenrl commented Feb 26, 2024

Thanks It was the "moduleResolution": "Bundler" that fix it.

@Ribeiro-Tiago
Copy link
Author

@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

@posva
Copy link
Owner

posva commented Feb 29, 2024

I think Vuex types need to be fixed 😅

@jmduke
Copy link

jmduke commented Mar 27, 2024

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!

@vzakharov
Copy link

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!

This (and none of the previous solutions in this page) was what made it work for me, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants