mineadmin / MineAdmin-Vue

MineAdmin Vue 是一个开源免费专门适配于 MineAdmin 后台权限管理系统的前端中后台模板,使用了 vue3, vite5, pinia, arco design, javascript 等主流开发技术,未使用Typescript,我们选择了简单。
MIT License
314 stars 102 forks source link

热更新的不生效问题 #164

Closed one-god closed 3 months ago

one-god commented 4 months ago

image 有点不懂,一样的目录层级也一样,一个是page reload 一个hmr update,而且大部分都是hmr update,不会去更新页面, 有人知道什么问题吗

dosubot[bot] commented 4 months ago

To address the issue where Hot Module Replacement (HMR) updates are not taking effect as expected, consider the following potential causes and solutions:

  1. Check Your Debounce Utility: Ensure the debounce utility's configuration isn't delaying or preventing HMR updates. Adjust the debounce timing if necessary.

  2. Review Direct DOM Manipulation: If your code manipulates the DOM directly, it might interfere with HMR. HMR works best with JavaScript modules, so changes to the DOM might not be automatically updated with module replacement.

  3. State Management Considerations: If your application's state is managed externally (e.g., Vuex, local storage), remember that HMR doesn't automatically reflect state changes. State management practices might need adjustment to work seamlessly with HMR.

  4. Vite Configuration: Verify your vite.config.js for any configurations that might disable HMR, specifically the server.hmr option. Ensure it's correctly set to enable HMR.

  5. Dependencies or Plugins: Some dependencies or plugins could interfere with HMR. Review the ones you're using for any known issues related to HMR.

  6. Check for Known Issues: Look into the release notes and GitHub issues for Vue and Vite for any known HMR-related issues with the versions you're using.

For a more precise diagnosis, additional details about your project structure, how handleWindowResize is integrated, and any console errors or warnings when HMR fails would be helpful.

#### Details **Sources** - [package.json](https://github.com/mineadmin/MineAdmin-Vue/blob/main/package.json) - [src/store/modules/app.js](https://github.com/mineadmin/MineAdmin-Vue/blob/main/src/store/modules/app.js) - [src/layout/components/columns/index.vue](https://github.com/mineadmin/MineAdmin-Vue/blob/main/src/layout/components/columns/index.vue) - [vite.config.js](https://github.com/mineadmin/MineAdmin-Vue/blob/main/vite.config.js) - [postcss.config.cjs](https://github.com/mineadmin/MineAdmin-Vue/blob/main/postcss.config.cjs)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

kanyxmo commented 3 months ago

这个应该是vite的问题,可以去vite提一下bug,这个情况偶尔出现的吧,可以试试重启项目