lib/utils.js
function getUpdatedEmittedFiles(emittedFiles, webpackRuntimeFiles) {
    let fallbackFiles = [];
    let hotHash;
    if (emittedFiles.some(x => x.endsWith('.hot-update.json'))) {
        let result = emittedFiles.slice();
        const hotUpdateScripts = emittedFiles.filter(x => x.endsWith('.hot-update.js'));
        hotUpdateScripts.forEach(hotUpdateScript => {
            const { name, hash } = parseHotUpdateChunkName(hotUpdateScript);
            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);
        return { emittedFiles: result, fallbackFiles, hash: hotHash };
    }
    else {
        return { emittedFiles, fallbackFiles };
    }
}
function getUpdatedEmittedFiles(emittedFiles, webpackRuntimeFiles) {
    let fallbackFiles = [];
    let hotHash;
    if (emittedFiles.some(x => x.endsWith('.hot-update.json'))) {
        let result = emittedFiles.slice();
        const hotUpdateScripts = emittedFiles.filter(x => x.endsWith('.hot-update.js'));
        hotUpdateScripts.forEach(hotUpdateScript => {
            const { name, hash } = parseHotUpdateChunkName(hotUpdateScript);
            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);
        return { emittedFiles: result, fallbackFiles, hash: hotHash };
    }
    else {
        return { emittedFiles, fallbackFiles };
    }
}
function getUpdatedEmittedFiles ( emittedFiles , webpackRuntimeFiles ) { let fallbackFiles = [ ] ; let hotHash ; if ( emittedFiles . some ( x => x . endsWith ( '.hot-update.json' ) ) ) { let result = emittedFiles . slice ( ) ; const hotUpdateScripts = emittedFiles . filter ( x => x . endsWith ( '.hot-update.js' ) ) ; hotUpdateScripts . forEach ( hotUpdateScript => { const { name , hash } = parseHotUpdateChunkName ( hotUpdateScript ) ; 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 } ` ) ; 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 ) ; return { emittedFiles : result , fallbackFiles , hash : hotHash } ; } else { return { emittedFiles , fallbackFiles } ; } }
Checks if there's a file in the following pattern 5e0326f3bb50f9f26cf0.hot-update.json
if yes this is a HMR update and remove all bundle files as we don't need them to be synced,
but only the update chunks
Checks if there s a file in the following pattern 5e0326f3bb50f9f26cf0 . hot - update . json if yes this is a HMR update and remove all bundle files as we don t need them to be synced but only the update chunks