Skip to content

Commit 7f3443f

Browse files
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.
1 parent 5550613 commit 7f3443f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/services/webpack/webpack-compiler-service.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
4949
return;
5050
}
5151

52-
// the hash of the compilation is the same as the previous one
53-
if (this.expectedHashes[platformData.platformNameLowerCase] === message.hash) {
54-
return;
55-
}
56-
52+
const previousHash = this.expectedHashes[platformData.platformNameLowerCase];
5753
let result;
5854

5955
if (prepareData.hmr) {
@@ -78,6 +74,12 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
7874
};
7975

8076
this.$logger.trace("Generated data from webpack message:", data);
77+
78+
// the hash of the compilation is the same as the previous one and there are only hot updates produced
79+
if (data.hasOnlyHotUpdateFiles && previousHash === message.hash) {
80+
return;
81+
}
82+
8183
if (data.files.length) {
8284
this.emit(WEBPACK_COMPILATION_COMPLETE, data);
8385
}

0 commit comments

Comments
 (0)