Skip to content

fix: handle correctly runtime files #4683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/services/webpack/webpack-compiler-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class WebpackCompilerService extends EventEmitter implements IWebpackComp
return;
}

const result = this.getUpdatedEmittedFiles(message.emittedFiles);
const result = this.getUpdatedEmittedFiles(message.emittedFiles, message.webpackRuntimeFiles);

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

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