带有HMR应用程序的NativeScript 6在每次更改时都会重新启动

问题描述 投票:0回答:1

我正在使用NativeScript 6.2.0在物理Android设备上进行测试(注9)。当我进行更改时,HMR将激活并显示以下内容:

JS: HMR: Checking for updates to the bundle with hmr hash 2e86b3ce6c9f6a005362.
JS: HMR: The following modules were updated:
JS: HMR:          ↻ ./components/friends/add_friends/add_friends.xml
JS: HMR: Successfully applied update with hmr hash 2e86b3ce6c9f6a005362. App is up to date.
Restarting application on device 278165d4781c7ece...
JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
JS: HMR: Checking for updates to the bundle with hmr hash 2e86b3ce6c9f6a005362.
JS: HMR: The following modules were updated:
JS: HMR:          ↻ ./components/friends/add_friends/add_friends.xml
JS: HMR: Successfully applied update with hmr hash 2e86b3ce6c9f6a005362. App is up to date.
JS: topmost() is deprecated. Use Frame.topmost() instead.
device: 278165d4781c7ece debug port: 40000

即使我只是更改了其中一个标签中的文本,也请注意该应用程序已重新启动。

这是我的package.json

{
  "nativescript": {
    "id": "io.company.app",
    "tns-android": {
      "version": "6.2.0"
    }
  },
  "main": "app.js",
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@nstudio/nativescript-camera-plus": "^3.0.3",
    "@nstudio/nativescript-loading-indicator": "^1.0.0",
    "nativescript": "^6.2.0",
    "nativescript-contacts": "^1.6.2",
    "nativescript-fonticon": "^2.0.0",
    "nativescript-masked-text-field": "4.0.3",
    "nativescript-permissions": "^1.3.8",
    "nativescript-theme-core": "2.0.5",
    "tns-core-modules": "6.2.0",
    "tns-platform-declarations": "6.2.0"
  },
  "devDependencies": {
    "nativescript-dev-webpack": "1.3.0",
    "typescript": "3.4.5"
  },
  "gitHead": "f28dbc60d74dd2cef4b645afd8fdd63bbb12c73e",
  "readme": "NativeScript Application"
}

我是否缺少使HMR正常工作的某些设置?

编辑:此外,似乎HMR不会加载CSS更改。我必须在ts文件之一中进行空格更改,以加载CSS。这整个事情使HMR毫无用处。

谢谢

nativescript
1个回答
0
投票

这解决了我的问题:

我做了一个rm -rf node_modules,然后进行了npm update和npm install,现在我有了HMR(也在scss项目上)-在Mac上的ios

© www.soinside.com 2019 - 2024. All rights reserved.