Skip to content

Commit c198956

Browse files
authored
Merge pull request #4683 from NativeScript/fatme/handle-runtime-files
fix: handle correctly runtime files
2 parents 5981c2c + 96c7cd7 commit c198956

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
3737
return;
3838
}
3939

40-
const result = this.getUpdatedEmittedFiles(message.emittedFiles);
40+
const result = this.getUpdatedEmittedFiles(message.emittedFiles, message.webpackRuntimeFiles);
4141

4242
const files = result.emittedFiles
4343
.filter((file: string) => file.indexOf("App_Resources") === -1)
@@ -173,7 +173,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
173173
return args;
174174
}
175175

176-
private getUpdatedEmittedFiles(emittedFiles: string[]) {
176+
private getUpdatedEmittedFiles(emittedFiles: string[], webpackRuntimeFiles: string[]) {
177177
let fallbackFiles: string[] = [];
178178
let hotHash;
179179
if (emittedFiles.some(x => x.endsWith('.hot-update.json'))) {
@@ -184,6 +184,10 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
184184
hotHash = hash;
185185
// remove bundle/vendor.js files if there's a bundle.XXX.hot-update.js or vendor.XXX.hot-update.js
186186
result = result.filter(file => file !== `${name}.js`);
187+
if (webpackRuntimeFiles && webpackRuntimeFiles.length) {
188+
// remove files containing only the Webpack runtime (e.g. runtime.js)
189+
result = result.filter(file => webpackRuntimeFiles.indexOf(file) === -1);
190+
}
187191
});
188192
//if applying of hot update fails, we must fallback to the full files
189193
fallbackFiles = emittedFiles.filter(file => result.indexOf(file) === -1);

0 commit comments

Comments
 (0)