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

Wrong hmr #2308

Closed
2 tasks done
anncwb opened this issue Feb 28, 2021 · 2 comments
Closed
2 tasks done

Wrong hmr #2308

anncwb opened this issue Feb 28, 2021 · 2 comments

Comments

@anncwb
Copy link
Contributor

anncwb commented Feb 28, 2021

⚠️ IMPORTANT ⚠️ Please do not ignore this template. If you do, your issue will be closed immediately.

Describe the bug

I encountered some hot update issues in my project. The variables in the file seem to disappear after the hot update. It may be okay before the version around beta.36, and the specific version is not very certain. But it appeared after a certain upgrade
I tried to restore it in the smallest example, I think this should be a bug rather than a writing problem

Reproduction

  • git clone https://github.com/anncwb/vite-hmr-bug
  • yarn && yarn dev
  • open http://localhost:3000/#/
  • The scenario here is to dynamically add routing, because my project really has dynamically added routing that will disappear after the hot update (I only restore this situation, I think other situations should be similar to this one). I set a timer in router/index.ts, which is convenient for observing the value of router.getRoutes() after hot update
  • Click the to page a link to jump to the PageA page
  • Open /src/views/PageA.vue and modify the value of Page A to trigger hot update
  • You can see as shown in the figure below. Because the timer is used here, it will print two consecutively, the length of 3 should be the timer before the hot update is triggered, and the length of 1 is the data after the hot update. The route added dynamically after the hot update here has been lost

image

This is just a minimal recurring example.
This problem has bothered me for a long time and has not been resolved.
If the above example does not explain well, you can try to pull this complicated example and reproduce it

System Info

  • vite version:2.0.4
  • Operating System:mac
  • Node version:14
  • Package manager (npm/yarn/pnpm) and version:yarn

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.
@cll123456
Copy link

热更新 ts 也不明显,ctrl + s 后,感觉更新不过来

@carl-jin
Copy link

热更新 ts 也不明显,ctrl + s 后,感觉更新不过来

估计是循环依赖注入太多了。会进入死循环

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

No branches or pull requests

3 participants