【发布时间】:2020-07-29 00:09:25
【问题描述】:
环境
- CLI:6.5.0
- 跨平台模块:6.5.1
- Android 运行时:6.5.0
- iOS 运行时:6.5.0
描述错误
当使用 vue 类组件样式 + typescript 保存任何文件时,它根本不会更新。给我以下错误:
File change detected. Starting incremental webpack compilation...
Successfully transferred bundle.609c813aedb0d81fb57e.hot-update.js on device emulator-5554.
Successfully transferred 609c813aedb0d81fb57e.hot-update.json on device emulator-5554.
JS: HMR: Checking for updates to the bundle with hmr hash 609c813aedb0d81fb57e.
JS: HMR: Ignored an update to unaccepted module:
JS: HMR: ➭ ./routes.ts
JS: HMR: ➭ ./main.ts
JS: HMR: Cannot apply update with hmr hash 609c813aedb0d81fb57e.
JS: HMR: Aborted because ./routes.ts is not accepted
JS: Update propagation: ./routes.ts -> ./main.ts
Refreshing application on device emulator-5554...
Successfully transferred bundle.js on device emulator-5554.
Successfully transferred runtime.js on device emulator-5554.
Successfully transferred vendor.js on device emulator-5554.
JS: HMR: Cannot apply update. A previous update aborted. Application needs to be restarted in order to apply the changes.
Restarting application on device emulator-5554...
这会导致整个应用程序重新启动,而没有 HRM 更新。
复制
基于nativescript 博客NativeScript-Vue with Class Components 更多示例见链接。
- npm install -g @vue/cli @vue/cli-init
- vue init nativescript-vue/vue-cli-template hmrbug。 (选择打字稿)
- npm i vue-class-component
- npm i vue-property-decorator
下一步: 创建以下模板:
<Label text="Hello" textWrap="true" />
然后在文本中添加一个hello
<Label text="Hello Hello" textWrap="true" />
检查错误。
预期行为
使用著名的 HMR 无需重启整个 App。我认为这是一个严重的问题或错误,因为它会在等待应用程序重新启动时降低您作为开发人员的工作效率。
【问题讨论】:
-
我认为这是 Github 问题,我相信 Vue + HMR 存在已知问题,我建议您禁用 HMR (
--no-hmr)。当然,它的效率较低,但总比在 HMR 时不时地重新加载中间被击中要好。 -
谢谢,我想我会继续使用--no-hmr。
标签: typescript nativescript nativescript-vue