From a6d5eb52eae1c7a9773d638674dbced7eb4aa6dd Mon Sep 17 00:00:00 2001 From: fatme Date: Fri, 15 Nov 2019 09:51:58 +0200 Subject: [PATCH] fix: fix livesync when `--no-hmr` option is provided and changes are reverted to the initial state of application Livesync doesn't work when `tns run ios --no-hmr` command is executed, same changes are synced and the application is reverted to its initial state. On first webpack compilation CLI stores the initial hash of the compilation but the stored hash is updated only in `hmr` mode. On the other side, CLI has a logic to return when the stored hash is the same as the current hash. So, when the changes are reverted to the initial state of the application, the current hash is the same as the first reported hash. This way, CLI doesn't execute any livesync logic after the reported changes from webpack process. Rel to: https://github.com/NativeScript/nativescript-cli/issues/5132 --- lib/services/webpack/webpack-compiler-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/webpack/webpack-compiler-service.ts b/lib/services/webpack/webpack-compiler-service.ts index 297e306bef..e46474bdf8 100644 --- a/lib/services/webpack/webpack-compiler-service.ts +++ b/lib/services/webpack/webpack-compiler-service.ts @@ -42,7 +42,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp if (message.emittedFiles) { if (isFirstWebpackWatchCompilation) { isFirstWebpackWatchCompilation = false; - this.expectedHashes[platformData.platformNameLowerCase] = message.hash; + this.expectedHashes[platformData.platformNameLowerCase] = prepareData.hmr ? message.hash : ""; return; }