Skip to content

Improve hmr development experience #617

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

Closed
wants to merge 4 commits into from

Conversation

libondev
Copy link

This plugin has been used in many of my projects and feels good, but the only problem is that I need to manually manage my hmr (import.meta.hot). This pr converts this operation to internal processing and provides a new createRouter method inside the vue-router/auto-routes module to simplify the problem of developers needing to manually manage hmr (internal processing occurs inside this function).

I don't know if this change is reasonable. I hope to get your correction opinion, because you are a professional in this regard. : )

… `createRouter`

NOTE: `handleHotUpdate` parameter is valid only when createRouter exported in `vue-router/auto-routes` is used.
Copy link
Owner

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be great to automatically add the HMR code but createRouter must be imported from vue-router for everything to work well. Maybe a solution is to automatically add the HMR code like in vuejs/pinia#2954

@github-project-automation github-project-automation bot moved this from 🆕 New to 👀 In review in unplugin-vue-router Apr 22, 2025
@libondev
Copy link
Author

It would be more appropriate to let the plug-in do the job, Maybe I should go through the ast to find the CreateOutter and inject this hmr code?

@posva
Copy link
Owner

posva commented Jun 4, 2025

I would really go with a version similar to vuejs/pinia#2954 and keep changes to the minimum

@libondev
Copy link
Author

libondev commented Jun 4, 2025

I would really go with a version similar to vuejs/pinia#2954 and keep changes to the minimum

I see. I'll try it.

@libondev libondev marked this pull request as draft June 4, 2025 09:25
@libondev
Copy link
Author

The new implementation is here, so close this pr.

@libondev libondev closed this Jun 10, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in unplugin-vue-router Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants