现象
终端显示 watch 成功,但菜单、页面或样式不变——需要强制刷新,甚至完全不更新。
原因
插件 UI 从 installed-plugins 动态加载,不像普通 Vite HMR。watch 更新 available-plugins(已安装时也会刷新 installed 副本)。浏览器仍可能缓存旧包。
- 未 Install 就 watch → 只更新 available-plugins
- 已安装 → 应刷新 installed 副本,但仍需强制刷新浏览器
- pluginVersion / 版本目录变更 → 重新 Install
- Base 前后端未运行 → 无法提供新文件
处理
- 在项目根目录运行 quan-erp watch <plugin>
- 确认 available-plugins/<name>/<version>/frontend/ 时间戳在更新
- 确认 installed-plugins/<name>/frontend/ 也在更新(或从 Modules UI Install)
- 强制刷新浏览器;在 Network 中确认不是旧代码的缓存 304
- 依赖或配置变更后重启 base frontend
- 优先使用 @quan-erp/cli