From 3b7def6e5537289be4dc6d2a63ba764e47b8fcbf Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 17 Feb 2020 10:51:23 +0200 Subject: [PATCH 1/3] fix: external files are not livesynced In case you have external files set in the webpack.config.js (or resources copied with CopyWebpackPlugin), the `tns run ...` command does not LiveSync them to device. Webpack compilation is triggered, but as the emitted files are not hot updates, the hot update hash of the compilation is the same as the previous one. In this case CLI decides there's nothing to sync. To fix this extend the check in webpack-compiler-service to be based not only on the comparison between previous and current hash, but on the emitted files as well - if there are files which are not hot updates, continue the execution even if the previous and current hash are the same. That's exactly the case with externals. --- lib/services/webpack/webpack-compiler-service.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/services/webpack/webpack-compiler-service.ts b/lib/services/webpack/webpack-compiler-service.ts index 0b353499c8..3151f8d813 100644 --- a/lib/services/webpack/webpack-compiler-service.ts +++ b/lib/services/webpack/webpack-compiler-service.ts @@ -49,11 +49,8 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp return; } - // the hash of the compilation is the same as the previous one - if (this.expectedHashes[platformData.platformNameLowerCase] === message.hash) { - return; - } - + // Persist the previousHash value before calling `this.getUpdatedEmittedFiles` as it will modify the expectedHashes object with the current hash + const previousHash = this.expectedHashes[platformData.platformNameLowerCase]; let result; if (prepareData.hmr) { @@ -78,6 +75,12 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp }; this.$logger.trace("Generated data from webpack message:", data); + + // the hash of the compilation is the same as the previous one and there are only hot updates produced + if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) { + return; + } + if (data.files.length) { this.emit(WEBPACK_COMPILATION_COMPLETE, data); } From b270f79ca9d56a4cf9aa23ef83fde916645729b6 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 17 Feb 2020 12:45:03 +0200 Subject: [PATCH 2/3] chore: update version to 6.4.1 --- npm-shrinkwrap.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b86b4a63af..6c5d819382 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "6.4.0", + "version": "6.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d8c9135c4e..8dad9ce3ca 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "preferGlobal": true, - "version": "6.4.0", + "version": "6.4.1", "author": "Telerik ", "description": "Command-line interface for building NativeScript projects", "bin": { From a9e1cf05317fa93684204773d26fa6531da42c1d Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 17 Feb 2020 12:47:02 +0200 Subject: [PATCH 3/3] release: cut 6.4.1 release --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba754c9ad8..f65a231091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ NativeScript CLI Changelog ================ +6.4.1 (2020, February 19) +=== + +### Fixed + +* [Fixed #5251](https://github.com/NativeScript/nativescript-cli/issues/5251): External files are not livesynced + + 6.4.0 (2020, February 11) ===