Skip to content

Commit e92cb13

Browse files
authored
Merge pull request #4786 from NativeScript/fatme/fix-ng-uglify
fix: don't restart application when lazy loaded code is changed in angular app with uglify option
2 parents e6613ab + 2ed8f26 commit e92cb13

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

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

+4-7
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
4545
let result;
4646

4747
if (prepareData.hmr) {
48-
result = this.getUpdatedEmittedFiles(message.emittedFiles, message.webpackRuntimeFiles, message.entryPointFiles);
48+
result = this.getUpdatedEmittedFiles(message.emittedFiles, message.chunkFiles);
4949
} else {
5050
result = { emittedFiles: message.emittedFiles, fallbackFiles: <string[]>[], hash: "" };
5151
}
@@ -218,16 +218,13 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
218218
return args;
219219
}
220220

221-
private getUpdatedEmittedFiles(emittedFiles: string[], webpackRuntimeFiles: string[], entryPointFiles: string[]) {
221+
private getUpdatedEmittedFiles(emittedFiles: string[], chunkFiles: string[]) {
222222
let fallbackFiles: string[] = [];
223223
let hotHash;
224224
let result = emittedFiles.slice();
225225
const hotUpdateScripts = emittedFiles.filter(x => x.endsWith('.hot-update.js'));
226-
if (webpackRuntimeFiles && webpackRuntimeFiles.length) {
227-
result = result.filter(file => webpackRuntimeFiles.indexOf(file) === -1);
228-
}
229-
if (entryPointFiles && entryPointFiles.length) {
230-
result = result.filter(file => entryPointFiles.indexOf(file) === -1);
226+
if (chunkFiles && chunkFiles.length) {
227+
result = result.filter(file => chunkFiles.indexOf(file) === -1);
231228
}
232229
hotUpdateScripts.forEach(hotUpdateScript => {
233230
const { name, hash } = this.parseHotUpdateChunkName(hotUpdateScript);

lib/services/webpack/webpack.d.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ declare global {
3434

3535
interface IWebpackEmitMessage {
3636
emittedFiles: string[];
37-
webpackRuntimeFiles: string[];
38-
entryPointFiles: string[];
37+
chunkFiles: string[];
3938
}
4039

4140
interface IPlatformProjectService extends NodeJS.EventEmitter, IPlatformProjectServiceBase {

0 commit comments

Comments
 (0)