Nativescript vue+;Typescript-HMR不在Vue类组件上工作

Nativescript vue+;Typescript-HMR不在Vue类组件上工作,typescript,nativescript,nativescript-vue,Typescript,Nativescript,Nativescript Vue,环境 CLI:6.5.0 跨平台模块:6.5.1 Android运行时:6.5.0 iOS运行时:6.5.0 描述错误 使用vue类组件样式+类型脚本保存任何文件时,它不会更新。请告诉我以下错误: File change detected. Starting incremental webpack compilation... Successfully transferred bundle.609c813aedb0d81fb57e.hot-update.js on device emulat

环境

  • CLI:6.5.0
  • 跨平台模块:6.5.1
  • Android运行时:6.5.0
  • iOS运行时:6.5.0
描述错误

使用vue类组件样式+类型脚本保存任何文件时,它不会更新。请告诉我以下错误:

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博客 链接上有更多示例。

  • npm安装-g@vue/cli@vue/cli init
  • vue init nativescript vue/vue cli模板hmrbug。(选择打字脚本)
  • npm i vue类组件
  • npm i vue属性装饰器
  • 下一步: 创建以下模板:

    然后在文本中添加一个hello

    检查错误

    预期行为

    使用著名的HMR,无需重新启动整个应用程序。我认为这是一个严重的问题或bug,因为在等待应用程序重新启动时,它会降低开发人员的生产力。p> 请使用tns调试android——无hmr 在nativescript中,vue和HMR不受保护。HMR只能在样式文件中进行更改时使用

    我的个人用途 我只使用
    tns debug android
    进行样式设置。如果我做出任何其他改变,我不信任HMR

    我添加了一个名为Thread devan的Thread脚本,以加快键入过程

    我在package.json文件中添加了以下行

    {
    “脚本”:{
    “dev”:“tns调试android”,
    “devan”:“tns调试android——无hmr”,
    “devin”:“tns调试ios——无hmr”,
    “un”:“adb卸载com.domain.yourapp”
    },
    }
    

    如果在nativescript vue项目中使用typescipt文件,您将始终看到HMR错误消息

    JS:HMR:使用HMR哈希7d5f6392d6103f1496e6检查捆绑包的更新。
    JS:WARN HMR:忽略了对不可接受模块的更新:
    JS:WARN HMR:➭ ./路由/索引.ts
    JS:WARN HMR:➭ ./梅因酒店
    JS:错误HMR:无法使用HMR哈希7d5f6392d6103f1496e6应用更新。
    JS:错误HMR:中止,因为不接受./routes/index.ts
    JS:更新传播:./routes/index.ts->./main.ts
    
    我的Nativescript Vue+Typescript与HMR项目一起工作。请注意(根据NS Vue的创建者rigor自己的说法),在使用样式时最好启用HMR


    以下是解决我问题的问题和线程:

    我认为这涉及Github问题,我相信Vue+HMR存在已知问题,我建议您禁用HMR(
    --无HMR
    )。当然,它效率低,但比每次在HMR重新加载时都要好。谢谢,我想我会继续使用NO-HMR。谢谢您的贡献!!!令人失望的是,nativescript还没有使用vue进行人力资源管理:C。