【发布时间】:2019-11-15 03:45:37
【问题描述】:
我正在使用 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 毫无用处。
谢谢
【问题讨论】:
-
请指定您正在执行的确切命令和操作。从您的日志看来,您正在使用
tns debug android命令。您是否通过任何其他标志? HMR 本身无需进一步配置即可工作。你能发送你的完整日志和你执行的确切命令吗? -
您的应用中有多个页面吗?您是在主页或根页面中应用此更改吗?
-
@Vladimirov,我正在使用 tns debug android,但我尝试使用 --hrm 标志并尝试从 Sidekick 启动应用程序。结果相同
-
@Manoj 我确实有多个页面。我将它应用到附加页面之一,而不是根。但无论我对哪个页面进行更改,都会发生同样的情况。
-
我不确定,HMR 似乎按我的预期工作。您是否在代码中的任何位置使用
topmost()?
标签: nativescript