我正在使用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毫无用处。
谢谢
答案 0 :(得分:0)
这解决了我的问题:
我做了一个rm -rf node_modules,然后进行npm update和npm install,现在我有了HMR(也在scss项目上)-在Mac上的ios
答案 1 :(得分:0)
更改 app.gradle 中的 applicationId 后,我遇到了类似的问题。我设置了第一个 applicationId。它现在正在工作。