diff --git a/lib/AsyncDependenciesBlock.js b/lib/AsyncDependenciesBlock.js index 806d84970..3bf22d2e2 100644 --- a/lib/AsyncDependenciesBlock.js +++ b/lib/AsyncDependenciesBlock.js @@ -6,15 +6,28 @@ const DependenciesBlock = require("./DependenciesBlock"); module.exports = class AsyncDependenciesBlock extends DependenciesBlock { - constructor(name, module, loc, request) { + constructor(groupOptions, module, loc, request) { super(); - this.chunkName = name; + if (typeof groupOptions === "string") { + groupOptions = { name: groupOptions }; + } else if (!groupOptions) { + groupOptions = { name: undefined }; + } + this.groupOptions = groupOptions; this.chunkGroup = undefined; this.module = module; this.loc = loc; this.request = request; } + get chunkName() { + return this.groupOptions.name; + } + + set chunkName(value) { + this.groupOptions.name = value; + } + get chunks() { throw new Error("Moved to AsyncDependenciesBlock.chunkGroup"); } @@ -24,7 +37,7 @@ module.exports = class AsyncDependenciesBlock extends DependenciesBlock { } updateHash(hash) { - hash.update(this.chunkName || ""); + hash.update(JSON.stringify(this.groupOptions)); hash.update( (this.chunkGroup && this.chunkGroup.chunks diff --git a/lib/Chunk.js b/lib/Chunk.js index 6a317a637..4e88ad223 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -170,8 +170,8 @@ class Chunk { if (aItem.done) return 0; const aModuleIdentifier = aItem.value.identifier(); const bModuleIdentifier = bItem.value.identifier(); - if (aModuleIdentifier > bModuleIdentifier) return -1; - if (aModuleIdentifier < bModuleIdentifier) return 1; + if (aModuleIdentifier < bModuleIdentifier) return -1; + if (aModuleIdentifier > bModuleIdentifier) return 1; } } @@ -361,6 +361,62 @@ class Chunk { }; } + getChildIdsByOrders() { + const lists = new Map(); + for (const group of this.groupsIterable) { + if (group.chunks[group.chunks.length - 1] === this) { + for (const childGroup of group.childrenIterable) { + // TODO webpack 5 remove this check for options + if (typeof childGroup.options === "object") { + for (const key of Object.keys(childGroup.options)) { + if (key.endsWith("Order")) { + const name = key.substr(0, key.length - "Order".length); + let list = lists.get(name); + if (list === undefined) lists.set(name, (list = [])); + list.push({ + order: childGroup.options[key], + group: childGroup + }); + } + } + } + } + } + } + const result = Object.create(null); + for (const [name, list] of lists) { + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + // TOOD webpack 5 remove this check of compareTo + if (a.group.compareTo) return a.group.compareTo(b.group); + return 0; + }); + result[name] = Array.from( + list.reduce((set, item) => { + for (const chunk of item.group.chunks) set.add(chunk.id); + return set; + }, new Set()) + ); + } + return result; + } + + getChildIdsByOrdersMap() { + const chunkMaps = Object.create(null); + + for (const chunk of this.getAllAsyncChunks()) { + const data = chunk.getChildIdsByOrders(); + for (const key of Object.keys(data)) { + let chunkMap = chunkMaps[key]; + if (chunkMap === undefined) + chunkMaps[key] = chunkMap = Object.create(null); + chunkMap[chunk.id] = data[key]; + } + } + return chunkMaps; + } + getChunkModuleMaps(filterFn) { const chunkModuleIdMap = Object.create(null); const chunkModuleHashMap = Object.create(null); diff --git a/lib/ChunkGroup.js b/lib/ChunkGroup.js index 6a1002710..23b2c219c 100644 --- a/lib/ChunkGroup.js +++ b/lib/ChunkGroup.js @@ -26,9 +26,14 @@ const sortOrigin = (a, b) => { }; class ChunkGroup { - constructor(name) { + constructor(options) { + if (typeof options === "string") { + options = { name: options }; + } else if (!options) { + options = { name: undefined }; + } this.groupDebugId = debugId++; - this.name = name; + this.options = options; this._children = new SortableSet(undefined, sortById); this._parents = new SortableSet(undefined, sortById); this._blocks = new SortableSet(); @@ -36,6 +41,30 @@ class ChunkGroup { this.origins = []; } + addOptions(options) { + for (const key of Object.keys(options)) { + if (this.options[key] === undefined) { + this.options[key] = options[key]; + } else if (this.options[key] !== options[key]) { + if (key.endsWith("Order")) { + this.options[key] = Math.max(this.options[key], options[key]); + } else { + throw new Error( + `ChunkGroup.addOptions: No option merge strategy for ${key}` + ); + } + } + } + } + + get name() { + return this.options.name; + } + + set name(value) { + this.options.name = value; + } + /* istanbul ignore next */ get debugId() { return Array.from(this.chunks, x => x.debugId).join("+"); @@ -222,6 +251,18 @@ class ChunkGroup { return false; } + getFiles() { + const files = new Set(); + + for (const chunk of this.chunks) { + for (const file of chunk.files) { + files.add(file); + } + } + + return Array.from(files); + } + remove(reason) { // cleanup parents for (const parentChunkGroup of this._parents) { @@ -269,6 +310,53 @@ class ChunkGroup { this._children.sort(); } + compareTo(otherGroup) { + if (this.chunks.length > otherGroup.chunks.length) return -1; + if (this.chunks.length < otherGroup.chunks.length) return 1; + const a = this.chunks[Symbol.iterator](); + const b = otherGroup.chunks[Symbol.iterator](); + // eslint-disable-next-line + while (true) { + const aItem = a.next(); + const bItem = b.next(); + if (aItem.done) return 0; + const cmp = aItem.value.compareTo(bItem.value); + if (cmp !== 0) return cmp; + } + } + + getChildrenByOrders() { + const lists = new Map(); + for (const childGroup of this._children) { + // TODO webpack 5 remove this check for options + if (typeof childGroup.options === "object") { + for (const key of Object.keys(childGroup.options)) { + if (key.endsWith("Order")) { + const name = key.substr(0, key.length - "Order".length); + let list = lists.get(name); + if (list === undefined) lists.set(name, (list = [])); + list.push({ + order: childGroup.options[key], + group: childGroup + }); + } + } + } + } + const result = Object.create(null); + for (const [name, list] of lists) { + list.sort((a, b) => { + const cmp = b.order - a.order; + if (cmp !== 0) return cmp; + // TOOD webpack 5 remove this check of compareTo + if (a.group.compareTo) return a.group.compareTo(b.group); + return 0; + }); + result[name] = list.map(i => i.group); + } + return result; + } + checkConstraints() { const chunk = this; for (const child of chunk._children) { diff --git a/lib/Compilation.js b/lib/Compilation.js index d6d54c4f1..baaf1e3ff 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -1006,17 +1006,22 @@ class Compilation extends Tapable { } } - addChunkInGroup(name, module, loc, request) { + addChunkInGroup(groupOptions, module, loc, request) { + if (typeof groupOptions === "string") { + groupOptions = { name: groupOptions }; + } + const name = groupOptions.name; if (name) { const chunkGroup = this.namedChunkGroups.get(name); if (chunkGroup !== undefined) { + chunkGroup.addOptions(groupOptions); if (module) { chunkGroup.addOrigin(module, loc, request); } return chunkGroup; } } - const chunkGroup = new ChunkGroup(name); + const chunkGroup = new ChunkGroup(groupOptions); if (module) chunkGroup.addOrigin(module, loc, request); const chunk = this.addChunk(name); @@ -1190,11 +1195,18 @@ class Compilation extends Tapable { ); c = chunkGroup; } else { - c = this.addChunkInGroup(b.chunkName, module, b.loc, b.request); + c = this.addChunkInGroup( + b.groupOptions || b.chunkName, + module, + b.loc, + b.request + ); blockChunkGroups.set(b, c); allCreatedChunkGroups.add(c); } } else { + // TODO webpack 5 remove addOptions check + if (c.addOptions) c.addOptions(b.groupOptions); c.addOrigin(module, b.loc, b.request); } diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 76ca66c9d..fd186bc90 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -12,7 +12,7 @@ const Template = require("./Template"); class ContextModule extends Module { // type ContextMode = "sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once" - // type ContextOptions = { resource: string, recursive: boolean, regExp: RegExp, addon?: string, mode?: ContextMode, chunkName?: string, include?: RegExp, exclude?: RegExp } + // type ContextOptions = { resource: string, recursive: boolean, regExp: RegExp, addon?: string, mode?: ContextMode, chunkName?: string, include?: RegExp, exclude?: RegExp, groupOptions?: Object } // resolveDependencies: (fs: FS, options: ContextOptions, (err: Error?, dependencies: Dependency[]) => void) => void // options: ContextOptions constructor(resolveDependencies, options) { @@ -81,6 +81,11 @@ class ContextModule extends Module { if (this.options.regExp) identifier += ` ${this.options.regExp}`; if (this.options.include) identifier += ` include: ${this.options.include}`; if (this.options.exclude) identifier += ` exclude: ${this.options.exclude}`; + if (this.options.groupOptions) { + identifier += ` groupOptions: ${JSON.stringify( + this.options.groupOptions + )}`; + } if (this.options.namespaceObject === "strict") identifier += " strict namespace object"; else if (this.options.namespaceObject) identifier += " namespace object"; @@ -106,6 +111,11 @@ class ContextModule extends Module { identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`; if (this.options.exclude) identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`; + if (this.options.groupOptions) { + const groupOptions = this.options.groupOptions; + for (const key of Object.keys(groupOptions)) + identifier += ` ${key}: ${groupOptions[key]}`; + } if (this.options.namespaceObject === "strict") identifier += " strict namespace object"; else if (this.options.namespaceObject) identifier += " namespace object"; @@ -170,7 +180,9 @@ class ContextModule extends Module { // and add that block to this context if (dependencies.length > 0) { const block = new AsyncDependenciesBlock( - this.options.chunkName, + Object.assign({}, this.options.groupOptions, { + name: this.options.chunkName + }), this ); for (const dep of dependencies) { @@ -202,7 +214,9 @@ class ContextModule extends Module { ); } const block = new AsyncDependenciesBlock( - chunkName, + Object.assign({}, this.options.groupOptions, { + name: chunkName + }), dep.module, dep.loc, dep.userRequest diff --git a/lib/Entrypoint.js b/lib/Entrypoint.js index 927a2cbd8..faaba3abc 100644 --- a/lib/Entrypoint.js +++ b/lib/Entrypoint.js @@ -16,18 +16,6 @@ class Entrypoint extends ChunkGroup { return true; } - getFiles() { - const files = new Set(); - - for (const chunk of this.chunks) { - for (const file of chunk.files) { - files.add(file); - } - } - - return Array.from(files); - } - setRuntimeChunk(chunk) { this.runtimeChunk = chunk; } diff --git a/lib/Stats.js b/lib/Stats.js index 5ddf87396..485080fef 100644 --- a/lib/Stats.js +++ b/lib/Stats.js @@ -401,12 +401,39 @@ class Stats { for (const keyValuePair of compilation.entrypoints) { const name = keyValuePair[0]; const ep = keyValuePair[1]; + const children = ep.getChildrenByOrders(); obj.entrypoints[name] = { chunks: ep.chunks.map(c => c.id), assets: ep.chunks.reduce( (array, c) => array.concat(c.files || []), [] - ) + ), + children: Object.keys(children).reduce((obj, key) => { + const groups = children[key]; + obj[key] = groups.map(group => ({ + name: group.name, + chunks: group.chunks.map(c => c.id), + assets: group.chunks.reduce( + (array, c) => array.concat(c.files || []), + [] + ) + })); + return obj; + }, Object.create(null)), + childAssets: Object.keys(children).reduce((obj, key) => { + const groups = children[key]; + obj[key] = Array.from( + groups.reduce((set, group) => { + for (const chunk of group.chunks) { + for (const asset of chunk.files) { + set.add(asset); + } + } + return set; + }, new Set()) + ); + return obj; + }, Object.create(null)) }; if (showPerformance) { obj.entrypoints[name].isOverSizeLimit = ep.isOverSizeLimit; @@ -519,6 +546,7 @@ class Stats { const parents = new Set(); const children = new Set(); const siblings = new Set(); + const childIdByOrder = chunk.getChildIdsByOrders(); for (const chunkGroup of chunk.groupsIterable) { for (const parentGroup of chunkGroup.parentsIterable) { for (const chunk of parentGroup.chunks) { @@ -547,7 +575,8 @@ class Stats { hash: chunk.renderedHash, siblings: Array.from(siblings).sort(), parents: Array.from(parents).sort(), - children: Array.from(children).sort() + children: Array.from(children).sort(), + childrenByOrder: childIdByOrder }; if (showChunkModules) { obj.modules = chunk @@ -851,6 +880,18 @@ class Stats { colors.normal(" "); colors.green(asset); } + for (const name of Object.keys(ep.childAssets)) { + const assets = ep.childAssets[name]; + if (assets && assets.length > 0) { + colors.normal(" "); + colors.magenta(`(${name}:`); + for (const asset of assets) { + colors.normal(" "); + colors.green(asset); + } + colors.magenta(")"); + } + } newline(); } } @@ -1103,6 +1144,19 @@ class Stats { colors.yellow(id); colors.normal("}<"); } + if (chunk.childrenByOrder) { + for (const name of Object.keys(chunk.childrenByOrder)) { + const children = chunk.childrenByOrder[name]; + colors.normal(" "); + colors.magenta(`(${name}:`); + for (const id of children) { + colors.normal(" {"); + colors.yellow(id); + colors.normal("}"); + } + colors.magenta(")"); + } + } if (chunk.entry) { colors.yellow(" [entry]"); } else if (chunk.initial) { diff --git a/lib/dependencies/ContextDependency.js b/lib/dependencies/ContextDependency.js index 387f27533..10c2fea99 100644 --- a/lib/dependencies/ContextDependency.js +++ b/lib/dependencies/ContextDependency.js @@ -9,7 +9,7 @@ const CriticalDependencyWarning = require("./CriticalDependencyWarning"); const regExpToString = r => (r ? r + "" : ""); class ContextDependency extends Dependency { - // options: { request, recursive, regExp, include, exclude, mode, chunkName } + // options: { request, recursive, regExp, include, exclude, mode, chunkName, groupOptions } constructor(options) { super(); this.options = options; @@ -29,7 +29,8 @@ class ContextDependency extends Dependency { `${regExpToString(this.options.regExp)} ${regExpToString( this.options.include )} ${regExpToString(this.options.exclude)} ` + - `${this.options.mode} ${this.options.chunkName}` + `${this.options.mode} ${this.options.chunkName} ` + + `${JSON.stringify(this.options.groupOptions)}` ); } diff --git a/lib/dependencies/ImportDependenciesBlock.js b/lib/dependencies/ImportDependenciesBlock.js index fdd5771fc..61e6bb272 100644 --- a/lib/dependencies/ImportDependenciesBlock.js +++ b/lib/dependencies/ImportDependenciesBlock.js @@ -7,8 +7,9 @@ const AsyncDependenciesBlock = require("../AsyncDependenciesBlock"); const ImportDependency = require("./ImportDependency"); module.exports = class ImportDependenciesBlock extends AsyncDependenciesBlock { - constructor(request, range, chunkName, module, loc, originModule) { - super(chunkName, module, loc, request); + // TODO webpack 5 reorganize arguments + constructor(request, range, groupOptions, module, loc, originModule) { + super(groupOptions, module, loc, request); this.range = range; const dep = new ImportDependency(request, originModule, this); dep.loc = loc; diff --git a/lib/dependencies/ImportParserPlugin.js b/lib/dependencies/ImportParserPlugin.js index e8fb74e90..d9e5f1273 100644 --- a/lib/dependencies/ImportParserPlugin.js +++ b/lib/dependencies/ImportParserPlugin.js @@ -29,11 +29,12 @@ class ImportParserPlugin { let mode = "lazy"; let include = null; let exclude = null; + const groupOptions = {}; const importOptions = parser.getCommentOptions(expr.range); if (importOptions) { if (typeof importOptions.webpackChunkName !== "undefined") { - if (typeof importOptions.webpackChunkName !== "string") + if (typeof importOptions.webpackChunkName !== "string") { parser.state.module.warnings.push( new UnsupportedFeatureWarning( parser.state.module, @@ -42,10 +43,12 @@ class ImportParserPlugin { }.` ) ); - else chunkName = importOptions.webpackChunkName; + } else { + chunkName = importOptions.webpackChunkName; + } } if (typeof importOptions.webpackMode !== "undefined") { - if (typeof importOptions.webpackMode !== "string") + if (typeof importOptions.webpackMode !== "string") { parser.state.module.warnings.push( new UnsupportedFeatureWarning( parser.state.module, @@ -54,7 +57,41 @@ class ImportParserPlugin { }.` ) ); - else mode = importOptions.webpackMode; + } else { + mode = importOptions.webpackMode; + } + } + if (typeof importOptions.webpackPrefetch !== "undefined") { + if (importOptions.webpackPrefetch === true) { + groupOptions.prefetchOrder = 0; + } else if (typeof importOptions.webpackPrefetch === "number") { + groupOptions.prefetchOrder = importOptions.webpackPrefetch; + } else { + parser.state.module.warnings.push( + new UnsupportedFeatureWarning( + parser.state.module, + `\`webpackPrefetch\` expected true or a number, but received: ${ + importOptions.webpackPrefetch + }.` + ) + ); + } + } + if (typeof importOptions.webpackPreload !== "undefined") { + if (importOptions.webpackPreload === true) { + groupOptions.preloadOrder = 0; + } else if (typeof importOptions.webpackPreload === "number") { + groupOptions.preloadOrder = importOptions.webpackPreload; + } else { + parser.state.module.warnings.push( + new UnsupportedFeatureWarning( + parser.state.module, + `\`webpackPreload\` expected true or a number, but received: ${ + importOptions.webpackPreload + }.` + ) + ); + } } if (typeof importOptions.webpackInclude !== "undefined") { if ( @@ -120,7 +157,9 @@ class ImportParserPlugin { const depBlock = new ImportDependenciesBlock( param.string, expr.range, - chunkName, + Object.assign(groupOptions, { + name: chunkName + }), parser.state.module, expr.loc, parser.state.module @@ -155,6 +194,7 @@ class ImportParserPlugin { this.options, { chunkName, + groupOptions, include, exclude, mode, diff --git a/lib/web/JsonpMainTemplatePlugin.js b/lib/web/JsonpMainTemplatePlugin.js index c13216572..78e53b507 100644 --- a/lib/web/JsonpMainTemplatePlugin.js +++ b/lib/web/JsonpMainTemplatePlugin.js @@ -36,84 +36,117 @@ class JsonpMainTemplatePlugin { "hash" ]); } + if (!mainTemplate.hooks.linkPreload) { + mainTemplate.hooks.linkPreload = new SyncWaterfallHook([ + "source", + "chunk", + "hash" + ]); + } + if (!mainTemplate.hooks.linkPrefetch) { + mainTemplate.hooks.linkPrefetch = new SyncWaterfallHook([ + "source", + "chunk", + "hash" + ]); + } + const getScriptSrcPath = (hash, chunk, chunkIdExpression) => { + const chunkFilename = mainTemplate.outputOptions.chunkFilename; + const chunkMaps = chunk.getChunkMaps(); + return mainTemplate.getAssetPath(JSON.stringify(chunkFilename), { + hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, + hashWithLength: length => + `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, + chunk: { + id: `" + ${chunkIdExpression} + "`, + hash: `" + ${JSON.stringify( + chunkMaps.hash + )}[${chunkIdExpression}] + "`, + hashWithLength(length) { + const shortChunkHashMap = Object.create(null); + for (const chunkId of Object.keys(chunkMaps.hash)) { + if (typeof chunkMaps.hash[chunkId] === "string") + shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr( + 0, + length + ); + } + return `" + ${JSON.stringify( + shortChunkHashMap + )}[${chunkIdExpression}] + "`; + }, + name: `" + (${JSON.stringify( + chunkMaps.name + )}[${chunkIdExpression}]||${chunkIdExpression}) + "`, + contentHash: { + javascript: `" + ${JSON.stringify( + chunkMaps.contentHash.javascript + )}[${chunkIdExpression}] + "` + }, + contentHashWithLength: { + javascript: length => { + const shortContentHashMap = {}; + const contentHash = chunkMaps.contentHash.javascript; + for (const chunkId of Object.keys(contentHash)) { + if (typeof contentHash[chunkId] === "string") { + shortContentHashMap[chunkId] = contentHash[chunkId].substr( + 0, + length + ); + } + } + return `" + ${JSON.stringify( + shortContentHashMap + )}[${chunkIdExpression}] + "`; + } + } + }, + contentHashType: "javascript" + }); + }; mainTemplate.hooks.localVars.tap( "JsonpMainTemplatePlugin", - (source, chunk) => { + (source, chunk, hash) => { if (needChunkLoadingCode(chunk)) { return Template.asString([ source, "", "// object to store loaded and loading chunks", + "// undefined = chunk not loaded, null = chunk preloaded/prefetched", + "// Promise = chunk loading, 0 = chunk loaded", "var installedChunks = {", Template.indent( chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n") ), "};", "", + "// script path function", + "function jsonpScriptSrc(chunkId) {", + Template.indent([ + `return ${mainTemplate.requireFn}.p + ${getScriptSrcPath( + hash, + chunk, + "chunkId" + )}` + ]), + "}", + "", needEntryDeferringCode(chunk) ? "var deferredModules = [];" : "" ]); } return source; } ); + mainTemplate.hooks.jsonpScript.tap( "JsonpMainTemplatePlugin", (_, chunk, hash) => { - const chunkFilename = mainTemplate.outputOptions.chunkFilename; - const chunkMaps = chunk.getChunkMaps(); const crossOriginLoading = mainTemplate.outputOptions.crossOriginLoading; const chunkLoadTimeout = mainTemplate.outputOptions.chunkLoadTimeout; const jsonpScriptType = mainTemplate.outputOptions.jsonpScriptType; - const scriptSrcPath = mainTemplate.getAssetPath( - JSON.stringify(chunkFilename), - { - hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`, - hashWithLength: length => - `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`, - chunk: { - id: '" + chunkId + "', - hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`, - hashWithLength(length) { - const shortChunkHashMap = Object.create(null); - for (const chunkId of Object.keys(chunkMaps.hash)) { - if (typeof chunkMaps.hash[chunkId] === "string") - shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr( - 0, - length - ); - } - return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`; - }, - name: `" + (${JSON.stringify( - chunkMaps.name - )}[chunkId]||chunkId) + "`, - contentHash: { - javascript: `" + ${JSON.stringify( - chunkMaps.contentHash.javascript - )}[chunkId] + "` - }, - contentHashWithLength: { - javascript: length => { - const shortContentHashMap = {}; - const contentHash = chunkMaps.contentHash.javascript; - for (const chunkId of Object.keys(contentHash)) { - if (typeof contentHash[chunkId] === "string") { - shortContentHashMap[chunkId] = contentHash[ - chunkId - ].substr(0, length); - } - } - return `" + ${JSON.stringify( - shortContentHashMap - )}[chunkId] + "`; - } - } - }, - contentHashType: "javascript" - } - ); + return Template.asString([ "var script = document.createElement('script');", jsonpScriptType @@ -129,7 +162,7 @@ class JsonpMainTemplatePlugin { `script.setAttribute("nonce", ${mainTemplate.requireFn}.nc);` ), "}", - `script.src = ${mainTemplate.requireFn}.p + ${scriptSrcPath};`, + "script.src = jsonpScriptSrc(chunkId);", "var timeout = setTimeout(function(){", Template.indent([ "onScriptComplete({ type: 'timeout', target: script });" @@ -162,8 +195,45 @@ class JsonpMainTemplatePlugin { ]); } ); - mainTemplate.hooks.requireEnsure.tap( + mainTemplate.hooks.linkPreload.tap( "JsonpMainTemplatePlugin", + (_, chunk, hash) => { + const crossOriginLoading = + mainTemplate.outputOptions.crossOriginLoading; + const jsonpScriptType = mainTemplate.outputOptions.jsonpScriptType; + + return Template.asString([ + "var link = document.createElement('link');", + jsonpScriptType + ? `link.type = ${JSON.stringify(jsonpScriptType)};` + : "", + "link.charset = 'utf-8';", + crossOriginLoading + ? `link.crossOrigin = ${JSON.stringify(crossOriginLoading)};` + : "", + `if (${mainTemplate.requireFn}.nc) {`, + Template.indent( + `link.setAttribute("nonce", ${mainTemplate.requireFn}.nc);` + ), + "}", + 'link.rel = "preload";', + 'link.as = "script";', + "link.href = jsonpScriptSrc(chunkId);" + ]); + } + ); + mainTemplate.hooks.linkPrefetch.tap( + "JsonpMainTemplatePlugin", + (_, chunk, hash) => { + return Template.asString([ + "var link = document.createElement('link');", + 'link.rel = "prefetch";', + "link.href = jsonpScriptSrc(chunkId);" + ]); + } + ); + mainTemplate.hooks.requireEnsure.tap( + "JsonpMainTemplatePlugin load", (source, chunk, hash) => { return Template.asString([ source, @@ -198,6 +268,80 @@ class JsonpMainTemplatePlugin { ]); } ); + mainTemplate.hooks.requireEnsure.tap( + { + name: "JsonpMainTemplatePlugin preload", + stage: 10 + }, + (source, chunk, hash) => { + const chunkMap = chunk.getChildIdsByOrdersMap().preload; + if (!chunkMap || Object.keys(chunkMap).length === 0) return source; + return Template.asString([ + source, + "", + "// chunk preloadng for javascript", + "", + `var chunkPreloadMap = ${JSON.stringify(chunkMap, null, "\t")}`, + "", + "var chunkPreloadData = chunkPreloadMap[chunkId];", + "if(chunkPreloadData) {", + Template.indent([ + "var head = document.getElementsByTagName('head')[0];", + "chunkPreloadData.forEach(function(chunkId) {", + Template.indent([ + "if(installedChunks[chunkId] === undefined) {", + Template.indent([ + "installedChunks[chunkId] = null;", + mainTemplate.hooks.linkPreload.call("", chunk, hash), + "head.appendChild(link);" + ]), + "}" + ]), + "});" + ]), + "}" + ]); + } + ); + mainTemplate.hooks.requireEnsure.tap( + { + name: "JsonpMainTemplatePlugin prefetch", + stage: 20 + }, + (source, chunk, hash) => { + const chunkMap = chunk.getChildIdsByOrdersMap().prefetch; + if (!chunkMap || Object.keys(chunkMap).length === 0) return source; + return Template.asString([ + source, + "", + "// chunk prefetching for javascript", + "", + `var chunkPrefetchMap = ${JSON.stringify(chunkMap, null, "\t")}`, + "", + "var chunkPrefetchData = chunkPrefetchMap[chunkId];", + "if(chunkPrefetchData) {", + Template.indent([ + "Promise.all(promises).then(function() {", + Template.indent([ + "var head = document.getElementsByTagName('head')[0];", + "chunkPrefetchData.forEach(function(chunkId) {", + Template.indent([ + "if(installedChunks[chunkId] === undefined) {", + Template.indent([ + "installedChunks[chunkId] = null;", + mainTemplate.hooks.linkPrefetch.call("", chunk, hash), + "head.appendChild(link);" + ]), + "}" + ]), + "});" + ]), + "})" + ]), + "}" + ]); + } + ); mainTemplate.hooks.requireExtensions.tap( "JsonpMainTemplatePlugin", (source, chunk) => { diff --git a/test/ConfigTestCases.test.js b/test/ConfigTestCases.test.js index 0ec1e0993..5819ac38c 100644 --- a/test/ConfigTestCases.test.js +++ b/test/ConfigTestCases.test.js @@ -149,8 +149,18 @@ describe("ConfigTestCases", () => { return test; } + function _beforeEach(title, fn) { + return suite.beforeEach(title, fn); + } + + function _afterEach(title, fn) { + return suite.afterEach(title, fn); + } + const globalContext = { - console: console + console: console, + setTimeout: setTimeout, + clearTimeout: clearTimeout }; function _require(currentDirectory, module) { @@ -175,7 +185,7 @@ describe("ConfigTestCases", () => { options.target === "webworker" ) { fn = vm.runInNewContext( - "(function(require, module, exports, __dirname, __filename, it, window) {" + + "(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach, window) {" + content + "\n})", globalContext, @@ -183,7 +193,7 @@ describe("ConfigTestCases", () => { ); } else { fn = vm.runInThisContext( - "(function(require, module, exports, __dirname, __filename, it) {" + + "(function(require, module, exports, __dirname, __filename, it, beforeEach, afterEach) {" + content + "\n})", p @@ -200,6 +210,8 @@ describe("ConfigTestCases", () => { path.dirname(p), p, _it, + _beforeEach, + _afterEach, globalContext ); return m.exports; diff --git a/test/configCases/web/prefetch-preload/chunk1-a.js b/test/configCases/web/prefetch-preload/chunk1-a.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/web/prefetch-preload/chunk1-b.js b/test/configCases/web/prefetch-preload/chunk1-b.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/web/prefetch-preload/chunk1-c.js b/test/configCases/web/prefetch-preload/chunk1-c.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/configCases/web/prefetch-preload/chunk1.js b/test/configCases/web/prefetch-preload/chunk1.js new file mode 100644 index 000000000..60d6f1685 --- /dev/null +++ b/test/configCases/web/prefetch-preload/chunk1.js @@ -0,0 +1,5 @@ +export default function() { + import(/* webpackPrefetch: true, webpackChunkName: "chunk1-a" */ "./chunk1-a"); + import(/* webpackPreload: true, webpackChunkName: "chunk1-b" */ "./chunk1-b"); + import(/* webpackPrefetch: 10, webpackChunkName: "chunk1-c" */ "./chunk1-c"); +} diff --git a/test/configCases/web/prefetch-preload/index.js b/test/configCases/web/prefetch-preload/index.js new file mode 100644 index 000000000..361620e85 --- /dev/null +++ b/test/configCases/web/prefetch-preload/index.js @@ -0,0 +1,57 @@ +const should = require("should"); +const FakeDocument = require("../../../helpers/FakeDocument"); + +let oldNonce; +let oldPublicPath; + +beforeEach(() => { + oldNonce = __webpack_nonce__; + oldPublicPath = __webpack_public_path__; + global.document = new FakeDocument(); +}); + +afterEach(() => { + delete global.document; + __webpack_nonce__ = oldNonce; + __webpack_public_path__ = oldPublicPath; +}) + +it("should prefetch and preload child chunks on chunk load", () => { + __webpack_nonce__ = "nonce"; + __webpack_public_path__ = "/public/path/"; + + const promise = import(/* webpackChunkName: "chunk1" */ "./chunk1"); + document.head._children.length.should.be.eql(2); + const script = document.head._children[0]; + script._type.should.be.eql("script"); + should(script.src).be.eql("/public/path/chunk1.js") + should(script.getAttribute("nonce")).be.eql("nonce") + should(script.crossOrigin).be.eql("anonymous"); + should(script.onload).be.type("function"); + + let link = document.head._children[1]; + link._type.should.be.eql("link"); + should(link.rel).be.eql("preload"); + should(link.as).be.eql("script"); + should(link.href).be.eql("/public/path/chunk1-b.js"); + should(link.charset).be.eql("utf-8"); + should(link.getAttribute("nonce")).be.eql("nonce"); + should(link.crossOrigin).be.eql("anonymous"); + + __non_webpack_require__("./chunk1.js"); + script.onload(); + + return promise.then((ex) => { + document.head._children.length.should.be.eql(4); + + let link = document.head._children[2]; + link._type.should.be.eql("link"); + should(link.rel).be.eql("prefetch"); + should(link.href).be.eql("/public/path/chunk1-c.js"); + + link = document.head._children[3]; + link._type.should.be.eql("link"); + should(link.rel).be.eql("prefetch"); + should(link.href).be.eql("/public/path/chunk1-a.js"); + }); +}) diff --git a/test/configCases/web/prefetch-preload/webpack.config.js b/test/configCases/web/prefetch-preload/webpack.config.js new file mode 100644 index 000000000..34460c414 --- /dev/null +++ b/test/configCases/web/prefetch-preload/webpack.config.js @@ -0,0 +1,13 @@ +module.exports = { + target: "web", + output: { + chunkFilename: "[name].js", + crossOriginLoading: "anonymous" + }, + performance: { + hints: false + }, + optimization: { + minimize: false + } +}; diff --git a/test/helpers/FakeDocument.js b/test/helpers/FakeDocument.js new file mode 100644 index 000000000..0c9d80de0 --- /dev/null +++ b/test/helpers/FakeDocument.js @@ -0,0 +1,36 @@ +module.exports = class FakeDocument { + constructor() { + this.head = this.createElement("head"); + } + + createElement(type) { + return new FakeElement(type); + } + + getElementsByTagName(name) { + if (name === "head") return [this.head]; + throw new Error( + `FakeDocument.getElementsByTagName(${name}): not implemented` + ); + } +}; + +class FakeElement { + constructor(type) { + this._type = type; + this._children = []; + this._attributes = Object.create(null); + } + + appendChild(node) { + this._children.push(node); + } + + setAttribute(name, value) { + this._attributes[name] = value; + } + + getAttribute(name) { + return this._attributes[name]; + } +} diff --git a/test/statsCases/aggressive-splitting-entry/expected.txt b/test/statsCases/aggressive-splitting-entry/expected.txt index bbfccc3b5..8f046830f 100644 --- a/test/statsCases/aggressive-splitting-entry/expected.txt +++ b/test/statsCases/aggressive-splitting-entry/expected.txt @@ -1,18 +1,18 @@ -Hash: a82dbd8d6c7a22df1cafa82dbd8d6c7a22df1caf +Hash: e3ba3c1dddc97b92dbf7e3ba3c1dddc97b92dbf7 Child fitting: - Hash: a82dbd8d6c7a22df1caf + Hash: e3ba3c1dddc97b92dbf7 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names fb95acf7c457672e70d0.js 1.05 KiB 0 [emitted] - a1e683753eca705a0882.js 9.97 KiB 1 [emitted] + 2795fd99577b4ba7fef2.js 10.2 KiB 1 [emitted] d43339a3d0f86c6b8d90.js 1.94 KiB 2 [emitted] 6c7fb52c5514dbfbf094.js 1.94 KiB 3 [emitted] - Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js a1e683753eca705a0882.js + Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js 2795fd99577b4ba7fef2.js chunk {0} fb95acf7c457672e70d0.js 916 bytes <{1}> <{2}> <{3}> > ./g [4] ./index.js 7:0-13 [7] ./g.js 916 bytes {0} [built] - chunk {1} a1e683753eca705a0882.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + chunk {1} 2795fd99577b4ba7fef2.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] > ./index main [3] ./e.js 899 bytes {1} [built] [4] ./index.js 111 bytes {1} [built] @@ -26,19 +26,19 @@ Child fitting: [1] ./c.js 899 bytes {3} [built] [2] ./d.js 899 bytes {3} [built] Child content-change: - Hash: a82dbd8d6c7a22df1caf + Hash: e3ba3c1dddc97b92dbf7 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names fb95acf7c457672e70d0.js 1.05 KiB 0 [emitted] - a1e683753eca705a0882.js 9.97 KiB 1 [emitted] + 2795fd99577b4ba7fef2.js 10.2 KiB 1 [emitted] d43339a3d0f86c6b8d90.js 1.94 KiB 2 [emitted] 6c7fb52c5514dbfbf094.js 1.94 KiB 3 [emitted] - Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js a1e683753eca705a0882.js + Entrypoint main = d43339a3d0f86c6b8d90.js 6c7fb52c5514dbfbf094.js 2795fd99577b4ba7fef2.js chunk {0} fb95acf7c457672e70d0.js 916 bytes <{1}> <{2}> <{3}> > ./g [4] ./index.js 7:0-13 [7] ./g.js 916 bytes {0} [built] - chunk {1} a1e683753eca705a0882.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] + chunk {1} 2795fd99577b4ba7fef2.js 1.87 KiB ={2}= ={3}= >{0}< [entry] [rendered] > ./index main [3] ./e.js 899 bytes {1} [built] [4] ./index.js 111 bytes {1} [built] diff --git a/test/statsCases/aggressive-splitting-on-demand/expected.txt b/test/statsCases/aggressive-splitting-on-demand/expected.txt index a64ff2fd6..2f3970dc4 100644 --- a/test/statsCases/aggressive-splitting-on-demand/expected.txt +++ b/test/statsCases/aggressive-splitting-on-demand/expected.txt @@ -1,4 +1,4 @@ -Hash: 7a73868d9be286944b0a +Hash: 0bbde62e97b9652dcaac Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names @@ -12,9 +12,9 @@ aafb9d82e452def4c3bb.js 1 KiB 1 [emitted] 344e13508b62e833aacf.js 1 KiB 7 [emitted] 2aaed192bbfbc2302c53.js 1.94 KiB 8 [emitted] 72e04d4eaed46d9aac4c.js 1.94 KiB 9 [emitted] -d20b83dfd7d0fd0c8793.js 8.41 KiB 10 [emitted] main +d19dabec0d62bca26765.js 8.68 KiB 10 [emitted] main 1165c0cca1ba14a506ff.js 1.94 KiB 11 [emitted] -Entrypoint main = d20b83dfd7d0fd0c8793.js +Entrypoint main = d19dabec0d62bca26765.js chunk {0} 4467a9f70ef8365bcb32.js 1.76 KiB <{10}> ={1}= ={2}= ={3}= ={7}= ={9}= [recorded] aggressive splitted > ./b ./d ./e ./f ./g [11] ./index.js 5:0-44 > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 @@ -56,7 +56,7 @@ chunk {9} 72e04d4eaed46d9aac4c.js 1.76 KiB <{10}> ={0}= ={2}= ={3}= ={7}= [re > ./b ./d ./e ./f ./g ./h ./i ./j ./k [11] ./index.js 6:0-72 [7] ./i.js 899 bytes {9} {11} [built] [8] ./j.js 901 bytes {6} {9} [built] -chunk {10} d20b83dfd7d0fd0c8793.js (main) 248 bytes >{0}< >{1}< >{11}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< [entry] [rendered] +chunk {10} d19dabec0d62bca26765.js (main) 248 bytes >{0}< >{1}< >{11}< >{2}< >{3}< >{4}< >{5}< >{6}< >{7}< >{8}< >{9}< [entry] [rendered] > ./index main [11] ./index.js 248 bytes {10} [built] chunk {11} 1165c0cca1ba14a506ff.js 1.76 KiB <{10}> ={2}= ={6}= [rendered] [recorded] aggressive splitted diff --git a/test/statsCases/async-commons-chunk/expected.txt b/test/statsCases/async-commons-chunk/expected.txt index ca0112474..bdbe8c27e 100644 --- a/test/statsCases/async-commons-chunk/expected.txt +++ b/test/statsCases/async-commons-chunk/expected.txt @@ -1,14 +1,14 @@ Entrypoint main = main.js -chunk {0} 0.js 21 bytes <{3}> ={1}= ={2}= [rendered] reused as split chunk (cache group: default) - > [3] ./index.js 17:1-21:3 +chunk {0} 0.js 21 bytes <{3}> [rendered] reused as split chunk (cache group: default) > [3] ./index.js 2:1-5:3 + [0] ./a.js 21 bytes {0} {1} {2} [built] +chunk {1} 1.js 42 bytes <{3}> [rendered] > ./a ./b [3] ./index.js 9:1-13:3 - [0] ./a.js 21 bytes {0} [built] -chunk {1} 1.js 21 bytes <{3}> ={0}= [rendered] - > ./a ./b [3] ./index.js 9:1-13:3 + [0] ./a.js 21 bytes {0} {1} {2} [built] [1] ./b.js 21 bytes {1} [built] -chunk {2} 2.js 21 bytes <{3}> ={0}= [rendered] +chunk {2} 2.js 42 bytes <{3}> [rendered] > [3] ./index.js 17:1-21:3 + [0] ./a.js 21 bytes {0} {1} {2} [built] [2] ./c.js 21 bytes {2} [built] chunk {3} main.js (main) 550 bytes >{0}< >{1}< >{2}< [entry] [rendered] > ./ main diff --git a/test/statsCases/chunks-development/expected.txt b/test/statsCases/chunks-development/expected.txt index fc9485d33..615dd812a 100644 --- a/test/statsCases/chunks-development/expected.txt +++ b/test/statsCases/chunks-development/expected.txt @@ -1,11 +1,11 @@ -Hash: e81afb52ad447e8765ab +Hash: d8b40b77893587325329 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.bundle.js 433 bytes 0 [emitted] 1.bundle.js 297 bytes 1 [emitted] 2.bundle.js 588 bytes 2 [emitted] - bundle.js 7.38 KiB main [emitted] main + bundle.js 7.65 KiB main [emitted] main Entrypoint main = bundle.js chunk {main} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] > ./index main diff --git a/test/statsCases/chunks/expected.txt b/test/statsCases/chunks/expected.txt index e98a6bf8c..b12c85752 100644 --- a/test/statsCases/chunks/expected.txt +++ b/test/statsCases/chunks/expected.txt @@ -1,10 +1,10 @@ -Hash: 4a1bda30edd6ae541ab2 +Hash: e99cd61934506d7567a3 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.bundle.js 152 bytes 0 [emitted] 1.bundle.js 289 bytes 1 [emitted] - bundle.js 7 KiB 2 [emitted] main + bundle.js 7.27 KiB 2 [emitted] main 3.bundle.js 227 bytes 3 [emitted] Entrypoint main = bundle.js chunk {0} 0.bundle.js 22 bytes <{2}> [rendered] diff --git a/test/statsCases/commons-chunk-min-size-0/expected.txt b/test/statsCases/commons-chunk-min-size-0/expected.txt index 97d37ae2f..4a2b4f0c5 100644 --- a/test/statsCases/commons-chunk-min-size-0/expected.txt +++ b/test/statsCases/commons-chunk-min-size-0/expected.txt @@ -2,7 +2,7 @@ Hash: cad25b99a073374722a7 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - entry-1.js 5.49 KiB 0 [emitted] entry-1 + entry-1.js 5.79 KiB 0 [emitted] entry-1 vendor-1~entry-1.js 314 bytes 1 [emitted] vendor-1~entry-1 Entrypoint entry-1 = vendor-1~entry-1.js entry-1.js [0] ./entry-1.js 145 bytes {0} [built] diff --git a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt b/test/statsCases/commons-chunk-min-size-Infinity/expected.txt index fe6ee6e6c..00f7c5aa4 100644 --- a/test/statsCases/commons-chunk-min-size-Infinity/expected.txt +++ b/test/statsCases/commons-chunk-min-size-Infinity/expected.txt @@ -2,7 +2,7 @@ Hash: c176225f44e51c7a39a4 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - entry-1.js 5.49 KiB 0 [emitted] entry-1 + entry-1.js 5.79 KiB 0 [emitted] entry-1 vendor-1.js 314 bytes 1 [emitted] vendor-1 Entrypoint entry-1 = vendor-1.js entry-1.js [0] ./entry-1.js 145 bytes {0} [built] diff --git a/test/statsCases/commons-plugin-issue-4980/expected.txt b/test/statsCases/commons-plugin-issue-4980/expected.txt index 36e56796a..8c19ca7a3 100644 --- a/test/statsCases/commons-plugin-issue-4980/expected.txt +++ b/test/statsCases/commons-plugin-issue-4980/expected.txt @@ -4,7 +4,7 @@ Child Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - app.js 5.58 KiB 0 [emitted] app + app.js 5.9 KiB 0 [emitted] app vendor.c0e73bece4137a7015c2.js 619 bytes 1 [emitted] vendor Entrypoint app = vendor.c0e73bece4137a7015c2.js app.js [./constants.js] 87 bytes {1} [built] @@ -17,7 +17,7 @@ Child Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - app.js 5.59 KiB 0 [emitted] app + app.js 5.92 KiB 0 [emitted] app vendor.c0e73bece4137a7015c2.js 619 bytes 1 [emitted] vendor Entrypoint app = vendor.c0e73bece4137a7015c2.js app.js [./constants.js] 87 bytes {1} [built] diff --git a/test/statsCases/import-context-filter/expected.txt b/test/statsCases/import-context-filter/expected.txt index 9744cd091..8883ce138 100644 --- a/test/statsCases/import-context-filter/expected.txt +++ b/test/statsCases/import-context-filter/expected.txt @@ -1,11 +1,11 @@ -Hash: 20afe8e9eb9a69aecddb +Hash: 736289137c8313a6d802 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.js 305 bytes 0 [emitted] 1.js 314 bytes 1 [emitted] 2.js 308 bytes 2 [emitted] -entry.js 7.8 KiB 3 [emitted] entry +entry.js 8.07 KiB 3 [emitted] entry Entrypoint entry = entry.js [0] ./templates/bar.js 38 bytes {0} [optional] [built] [1] ./templates/baz.js 38 bytes {1} [optional] [built] diff --git a/test/statsCases/import-weak/expected.txt b/test/statsCases/import-weak/expected.txt index 59bf9df59..e1283ab69 100644 --- a/test/statsCases/import-weak/expected.txt +++ b/test/statsCases/import-weak/expected.txt @@ -1,9 +1,9 @@ -Hash: 1f9db3ad053a3687e3bb +Hash: 1c55fc2d238369c62239 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.js 149 bytes 0 [emitted] -entry.js 7.79 KiB 1 [emitted] entry +entry.js 8.06 KiB 1 [emitted] entry Entrypoint entry = entry.js [0] ./modules/b.js 22 bytes {0} [built] [1] ./entry.js 120 bytes {1} [built] diff --git a/test/statsCases/limit-chunk-count-plugin/expected.txt b/test/statsCases/limit-chunk-count-plugin/expected.txt index f6cd14a33..88012eed7 100644 --- a/test/statsCases/limit-chunk-count-plugin/expected.txt +++ b/test/statsCases/limit-chunk-count-plugin/expected.txt @@ -1,10 +1,10 @@ -Hash: 599eb45be3863921e183f90c7b21ae5c6e853a0df3a313c9918d7d712c3f113bf580db9e5c6196ce +Hash: 89bb5076b735d47082582924d303eb8bcffb1c785cc24ae5dbdd7c6bafb935e3a49d38d6f5cc7854 Child 1 chunks: - Hash: 599eb45be3863921e183 + Hash: 89bb5076b735d4708258 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - bundle.js 5.68 KiB 0 [emitted] main + bundle.js 5.98 KiB 0 [emitted] main Entrypoint main = bundle.js chunk {0} bundle.js (main) 191 bytes <{0}> >{0}< [entry] [rendered] [0] ./index.js 73 bytes {0} [built] @@ -14,12 +14,12 @@ Child 1 chunks: [4] ./d.js 22 bytes {0} [built] [5] ./e.js 22 bytes {0} [built] Child 2 chunks: - Hash: f90c7b21ae5c6e853a0d + Hash: 2924d303eb8bcffb1c78 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.bundle.js 1 KiB 0 [emitted] - bundle.js 7.19 KiB 1 [emitted] main + bundle.js 7.46 KiB 1 [emitted] main Entrypoint main = bundle.js chunk {0} 0.bundle.js 118 bytes <{0}> <{1}> >{0}< [rendered] [0] ./d.js 22 bytes {0} [built] @@ -30,13 +30,13 @@ Child 2 chunks: chunk {1} bundle.js (main) 73 bytes >{0}< [entry] [rendered] [5] ./index.js 73 bytes {1} [built] Child 3 chunks: - Hash: f3a313c9918d7d712c3f + Hash: 5cc24ae5dbdd7c6bafb9 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.bundle.js 886 bytes 0 [emitted] 1.bundle.js 245 bytes 1 [emitted] - bundle.js 7.19 KiB 2 [emitted] main + bundle.js 7.46 KiB 2 [emitted] main Entrypoint main = bundle.js chunk {0} 0.bundle.js 74 bytes <{0}> <{2}> >{0}< >{1}< [rendered] [0] ./d.js 22 bytes {0} [built] @@ -48,14 +48,14 @@ Child 3 chunks: chunk {2} bundle.js (main) 73 bytes >{0}< >{1}< [entry] [rendered] [5] ./index.js 73 bytes {2} [built] Child 4 chunks: - Hash: 113bf580db9e5c6196ce + Hash: 35e3a49d38d6f5cc7854 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.bundle.js 236 bytes 0 [emitted] 1.bundle.js 245 bytes 1 [emitted] 2.bundle.js 715 bytes 2 [emitted] - bundle.js 7.19 KiB 3 [emitted] main + bundle.js 7.46 KiB 3 [emitted] main Entrypoint main = bundle.js chunk {0} 0.bundle.js 44 bytes <{2}> <{3}> [rendered] [0] ./d.js 22 bytes {0} [built] diff --git a/test/statsCases/module-assets/expected.txt b/test/statsCases/module-assets/expected.txt index bb8da025e..723eea28d 100644 --- a/test/statsCases/module-assets/expected.txt +++ b/test/statsCases/module-assets/expected.txt @@ -1,4 +1,4 @@ -Hash: d71bd16b0b20f34e994a +Hash: 021e4419d6957e08eedd Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint main = main.js diff --git a/test/statsCases/module-deduplication-named/expected.txt b/test/statsCases/module-deduplication-named/expected.txt index 670bcf76e..1c68b4453 100644 --- a/test/statsCases/module-deduplication-named/expected.txt +++ b/test/statsCases/module-deduplication-named/expected.txt @@ -2,9 +2,9 @@ async3.js 818 bytes 0 [emitted] async3 async1.js 818 bytes 1 [emitted] async1 async2.js 818 bytes 2 [emitted] async2 - e1.js 8.02 KiB 3 [emitted] e1 - e2.js 8.05 KiB 4 [emitted] e2 - e3.js 8.07 KiB 5 [emitted] e3 + e1.js 8.29 KiB 3 [emitted] e1 + e2.js 8.31 KiB 4 [emitted] e2 + e3.js 8.33 KiB 5 [emitted] e3 Entrypoint e1 = e1.js Entrypoint e2 = e2.js Entrypoint e3 = e3.js diff --git a/test/statsCases/module-deduplication/expected.txt b/test/statsCases/module-deduplication/expected.txt index fe5cd0993..1dd7c9037 100644 --- a/test/statsCases/module-deduplication/expected.txt +++ b/test/statsCases/module-deduplication/expected.txt @@ -5,9 +5,9 @@ Asset Size Chunks Chunk Names 3.js 661 bytes 3 [emitted] 4.js 661 bytes 4 [emitted] 5.js 661 bytes 5 [emitted] -e1.js 8.14 KiB 6 [emitted] e1 -e2.js 8.16 KiB 7 [emitted] e2 -e3.js 8.18 KiB 8 [emitted] e3 +e1.js 8.4 KiB 6 [emitted] e1 +e2.js 8.43 KiB 7 [emitted] e2 +e3.js 8.45 KiB 8 [emitted] e3 Entrypoint e1 = e1.js Entrypoint e2 = e2.js Entrypoint e3 = e3.js diff --git a/test/statsCases/named-chunks-plugin-async/expected.txt b/test/statsCases/named-chunks-plugin-async/expected.txt index 23359057f..1bf804994 100644 --- a/test/statsCases/named-chunks-plugin-async/expected.txt +++ b/test/statsCases/named-chunks-plugin-async/expected.txt @@ -1,10 +1,10 @@ -Hash: c5b0089a4015e8744f8e +Hash: f7d13fc86234627ae268 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names chunk-containing-__a_js.js 509 bytes chunk-containing-__a_js [emitted] chunk-containing-__b_js.js 173 bytes chunk-containing-__b_js [emitted] - entry.js 7.28 KiB entry [emitted] entry + entry.js 7.55 KiB entry [emitted] entry Entrypoint entry = entry.js [0] ./modules/b.js 22 bytes {chunk-containing-__b_js} [built] [1] ./modules/a.js 37 bytes {chunk-containing-__a_js} [built] diff --git a/test/statsCases/named-chunks-plugin/expected.txt b/test/statsCases/named-chunks-plugin/expected.txt index c5cf2bee3..b4bcb7705 100644 --- a/test/statsCases/named-chunks-plugin/expected.txt +++ b/test/statsCases/named-chunks-plugin/expected.txt @@ -2,7 +2,7 @@ Hash: 5df55d54223f36cc303b Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names - entry.js 5.34 KiB entry [emitted] entry + entry.js 5.64 KiB entry [emitted] entry vendor.js 269 bytes vendor [emitted] vendor Entrypoint entry = vendor.js entry.js [./entry.js] 72 bytes {entry} [built] diff --git a/test/statsCases/optimize-chunks/expected.txt b/test/statsCases/optimize-chunks/expected.txt index c75ed93a6..37a2a0a38 100644 --- a/test/statsCases/optimize-chunks/expected.txt +++ b/test/statsCases/optimize-chunks/expected.txt @@ -1,4 +1,4 @@ -Hash: c4c4476c6d07e1bf7404 +Hash: b643225c9d2e70212495 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names @@ -6,7 +6,7 @@ Built at: Thu Jan 01 1970 00:00:00 GMT ab.js 183 bytes 1 [emitted] ab abd.js 277 bytes 2, 1 [emitted] abd cir2.js 299 bytes 3 [emitted] cir2 - main.js 7.8 KiB 4 [emitted] main + main.js 8.07 KiB 4 [emitted] main cir2 from cir1.js 359 bytes 5, 3 [emitted] cir2 from cir1 chunk.js 190 bytes 6, 7 [emitted] chunk ac in ab.js 130 bytes 7 [emitted] ac in ab diff --git a/test/statsCases/prefetch-preload-mixed/a.js b/test/statsCases/prefetch-preload-mixed/a.js new file mode 100644 index 000000000..55e534918 --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/a.js @@ -0,0 +1,2 @@ +import(/* webpackPrefetch: true, webpackChunkName: "a1" */ "./a1"); +import(/* webpackPrefetch: true, webpackChunkName: "a2" */ "./a2"); diff --git a/test/statsCases/prefetch-preload-mixed/a1.js b/test/statsCases/prefetch-preload-mixed/a1.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch-preload-mixed/a2.js b/test/statsCases/prefetch-preload-mixed/a2.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch-preload-mixed/b.js b/test/statsCases/prefetch-preload-mixed/b.js new file mode 100644 index 000000000..756debf2d --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/b.js @@ -0,0 +1,3 @@ +import(/* webpackPrefetch: true, webpackChunkName: "b1" */ "./b1"); +import(/* webpackPreload: true, webpackChunkName: "b2" */ "./b2"); +import(/* webpackPrefetch: true, webpackChunkName: "b3" */ "./b3"); diff --git a/test/statsCases/prefetch-preload-mixed/b1.js b/test/statsCases/prefetch-preload-mixed/b1.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch-preload-mixed/b2.js b/test/statsCases/prefetch-preload-mixed/b2.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch-preload-mixed/b3.js b/test/statsCases/prefetch-preload-mixed/b3.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch-preload-mixed/c.js b/test/statsCases/prefetch-preload-mixed/c.js new file mode 100644 index 000000000..33838a297 --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/c.js @@ -0,0 +1,2 @@ +import(/* webpackPreload: true, webpackChunkName: "c1" */ "./c1"); +import(/* webpackPreload: true, webpackChunkName: "c2" */ "./c2"); diff --git a/test/statsCases/prefetch-preload-mixed/c1.js b/test/statsCases/prefetch-preload-mixed/c1.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch-preload-mixed/c2.js b/test/statsCases/prefetch-preload-mixed/c2.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch-preload-mixed/expected.txt b/test/statsCases/prefetch-preload-mixed/expected.txt new file mode 100644 index 000000000..55597681b --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/expected.txt @@ -0,0 +1,11 @@ +chunk {0} a.js (a) 136 bytes <{3}> >{10}< >{9}< (prefetch: {9} {10}) [rendered] +chunk {1} b.js (b) 203 bytes <{3}> >{6}< >{7}< >{8}< (prefetch: {6} {8}) (preload: {7}) [rendered] +chunk {2} c.js (c) 134 bytes <{3}> >{4}< >{5}< (preload: {4} {5}) [rendered] +chunk {3} main.js (main) 195 bytes >{0}< >{1}< >{2}< (prefetch: {0} {1} {2}) [entry] [rendered] +chunk {4} c1.js (c1) 0 bytes <{2}> [rendered] +chunk {5} c2.js (c2) 0 bytes <{2}> [rendered] +chunk {6} b1.js (b1) 0 bytes <{1}> [rendered] +chunk {7} b2.js (b2) 0 bytes <{1}> [rendered] +chunk {8} b3.js (b3) 0 bytes <{1}> [rendered] +chunk {9} a1.js (a1) 0 bytes <{0}> [rendered] +chunk {10} a2.js (a2) 0 bytes <{0}> [rendered] \ No newline at end of file diff --git a/test/statsCases/prefetch-preload-mixed/index.js b/test/statsCases/prefetch-preload-mixed/index.js new file mode 100644 index 000000000..a1bb65b54 --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/index.js @@ -0,0 +1,3 @@ +import(/* webpackPrefetch: true, webpackChunkName: "a" */"./a"); +import(/* webpackPrefetch: true, webpackChunkName: "b" */"./b"); +import(/* webpackPrefetch: true, webpackChunkName: "c" */"./c"); diff --git a/test/statsCases/prefetch-preload-mixed/webpack.config.js b/test/statsCases/prefetch-preload-mixed/webpack.config.js new file mode 100644 index 000000000..85c108d2e --- /dev/null +++ b/test/statsCases/prefetch-preload-mixed/webpack.config.js @@ -0,0 +1,8 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: { + all: false, + chunks: true + } +}; diff --git a/test/statsCases/prefetch/expected.txt b/test/statsCases/prefetch/expected.txt new file mode 100644 index 000000000..1c4aa09a0 --- /dev/null +++ b/test/statsCases/prefetch/expected.txt @@ -0,0 +1,16 @@ + Asset Size Chunks Chunk Names + prefetched.js 1.03 KiB 0 [emitted] prefetched + normal.js 130 bytes 1 [emitted] normal +prefetched2.js 127 bytes 2 [emitted] prefetched2 +prefetched3.js 130 bytes 3 [emitted] prefetched3 + main.js 9.69 KiB 4 [emitted] main + inner.js 136 bytes 5 [emitted] inner + inner2.js 201 bytes 6 [emitted] inner2 +Entrypoint main = main.js (prefetch: prefetched2.js prefetched.js prefetched3.js) +chunk {0} prefetched.js (prefetched) 228 bytes <{4}> >{5}< >{6}< (prefetch: {6} {5}) [rendered] +chunk {1} normal.js (normal) 0 bytes <{4}> [rendered] +chunk {2} prefetched2.js (prefetched2) 0 bytes <{4}> [rendered] +chunk {3} prefetched3.js (prefetched3) 0 bytes <{4}> [rendered] +chunk {4} main.js (main) 436 bytes >{0}< >{1}< >{2}< >{3}< (prefetch: {2} {0} {3}) [entry] [rendered] +chunk {5} inner.js (inner) 0 bytes <{0}> [rendered] +chunk {6} inner2.js (inner2) 0 bytes <{0}> [rendered] \ No newline at end of file diff --git a/test/statsCases/prefetch/index.js b/test/statsCases/prefetch/index.js new file mode 100644 index 000000000..9b6aaeab5 --- /dev/null +++ b/test/statsCases/prefetch/index.js @@ -0,0 +1,5 @@ +import "./with-nested"; +import(/* webpackPrefetch: 1, webpackChunkName: "prefetched" */ "./prefetched"); +setTimeout(() => { + import(/* webpackChunkName: "normal" */"./normal"); +}, 500); diff --git a/test/statsCases/prefetch/inner.js b/test/statsCases/prefetch/inner.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch/inner2.js b/test/statsCases/prefetch/inner2.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch/inner3.js b/test/statsCases/prefetch/inner3.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch/normal.js b/test/statsCases/prefetch/normal.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch/prefetched.js b/test/statsCases/prefetch/prefetched.js new file mode 100644 index 000000000..63683ca27 --- /dev/null +++ b/test/statsCases/prefetch/prefetched.js @@ -0,0 +1,5 @@ +setTimeout(() => { + import(/* webpackPrefetch: 10, webpackChunkName: "inner" */"./inner"); + import(/* webpackPrefetch: 20, webpackChunkName: "inner2" */"./inner2"); + import(/* webpackChunkName: "inner2" */"./inner3"); +}, 5000); diff --git a/test/statsCases/prefetch/prefetched2.js b/test/statsCases/prefetch/prefetched2.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch/prefetched3.js b/test/statsCases/prefetch/prefetched3.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/prefetch/webpack.config.js b/test/statsCases/prefetch/webpack.config.js new file mode 100644 index 000000000..17dba56db --- /dev/null +++ b/test/statsCases/prefetch/webpack.config.js @@ -0,0 +1,10 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: { + all: false, + assets: true, + entrypoints: true, + chunks: true + } +}; diff --git a/test/statsCases/prefetch/with-nested.js b/test/statsCases/prefetch/with-nested.js new file mode 100644 index 000000000..0720ce6e7 --- /dev/null +++ b/test/statsCases/prefetch/with-nested.js @@ -0,0 +1,3 @@ +import(/* webpackPrefetch: -20, webpackChunkName: "prefetched2" */"./prefetched2"); +import(/* webpackPrefetch: 3, webpackChunkName: "prefetched2" */"./prefetched2"); +import(/* webpackPrefetch: -10, webpackChunkName: "prefetched3" */"./prefetched3"); diff --git a/test/statsCases/preload/expected.txt b/test/statsCases/preload/expected.txt new file mode 100644 index 000000000..75bf0ae9f --- /dev/null +++ b/test/statsCases/preload/expected.txt @@ -0,0 +1,16 @@ + Asset Size Chunks Chunk Names + preloaded.js 1.03 KiB 0 [emitted] preloaded + normal.js 130 bytes 1 [emitted] normal +preloaded2.js 127 bytes 2 [emitted] preloaded2 +preloaded3.js 130 bytes 3 [emitted] preloaded3 + main.js 9.81 KiB 4 [emitted] main + inner.js 136 bytes 5 [emitted] inner + inner2.js 201 bytes 6 [emitted] inner2 +Entrypoint main = main.js (preload: preloaded2.js preloaded.js preloaded3.js) +chunk {0} preloaded.js (preloaded) 226 bytes <{4}> >{5}< >{6}< (preload: {6} {5}) [rendered] +chunk {1} normal.js (normal) 0 bytes <{4}> [rendered] +chunk {2} preloaded2.js (preloaded2) 0 bytes <{4}> [rendered] +chunk {3} preloaded3.js (preloaded3) 0 bytes <{4}> [rendered] +chunk {4} main.js (main) 424 bytes >{0}< >{1}< >{2}< >{3}< (preload: {2} {0} {3}) [entry] [rendered] +chunk {5} inner.js (inner) 0 bytes <{0}> [rendered] +chunk {6} inner2.js (inner2) 0 bytes <{0}> [rendered] \ No newline at end of file diff --git a/test/statsCases/preload/index.js b/test/statsCases/preload/index.js new file mode 100644 index 000000000..2578b3824 --- /dev/null +++ b/test/statsCases/preload/index.js @@ -0,0 +1,5 @@ +import "./with-nested"; +import(/* webpackPreload: 1, webpackChunkName: "preloaded" */ "./preloaded"); +setTimeout(() => { + import(/* webpackChunkName: "normal" */"./normal"); +}, 500); diff --git a/test/statsCases/preload/inner.js b/test/statsCases/preload/inner.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/preload/inner2.js b/test/statsCases/preload/inner2.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/preload/inner3.js b/test/statsCases/preload/inner3.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/preload/normal.js b/test/statsCases/preload/normal.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/preload/preloaded.js b/test/statsCases/preload/preloaded.js new file mode 100644 index 000000000..02f02b8e8 --- /dev/null +++ b/test/statsCases/preload/preloaded.js @@ -0,0 +1,5 @@ +setTimeout(() => { + import(/* webpackPreload: 10, webpackChunkName: "inner" */"./inner"); + import(/* webpackPreload: 20, webpackChunkName: "inner2" */"./inner2"); + import(/* webpackChunkName: "inner2" */"./inner3"); +}, 5000); diff --git a/test/statsCases/preload/preloaded2.js b/test/statsCases/preload/preloaded2.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/preload/preloaded3.js b/test/statsCases/preload/preloaded3.js new file mode 100644 index 000000000..e69de29bb diff --git a/test/statsCases/preload/webpack.config.js b/test/statsCases/preload/webpack.config.js new file mode 100644 index 000000000..17dba56db --- /dev/null +++ b/test/statsCases/preload/webpack.config.js @@ -0,0 +1,10 @@ +module.exports = { + mode: "production", + entry: "./index", + stats: { + all: false, + assets: true, + entrypoints: true, + chunks: true + } +}; diff --git a/test/statsCases/preload/with-nested.js b/test/statsCases/preload/with-nested.js new file mode 100644 index 000000000..0b7a826e1 --- /dev/null +++ b/test/statsCases/preload/with-nested.js @@ -0,0 +1,3 @@ +import(/* webpackPreload: -20, webpackChunkName: "preloaded2" */"./preloaded2"); +import(/* webpackPreload: 3, webpackChunkName: "preloaded2" */"./preloaded2"); +import(/* webpackPreload: -10, webpackChunkName: "preloaded3" */"./preloaded3"); diff --git a/test/statsCases/preset-detailed/expected.txt b/test/statsCases/preset-detailed/expected.txt index 809e2d594..353b8af1d 100644 --- a/test/statsCases/preset-detailed/expected.txt +++ b/test/statsCases/preset-detailed/expected.txt @@ -1,10 +1,10 @@ -Hash: a181afd92c30187a0eba +Hash: 5a6d9c01f46a5330eee6 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.js 152 bytes 0 [emitted] 1.js 289 bytes 1 [emitted] -main.js 7.01 KiB 2 [emitted] main +main.js 7.28 KiB 2 [emitted] main 3.js 227 bytes 3 [emitted] Entrypoint main = main.js chunk {0} 0.js 22 bytes <{2}> [rendered] diff --git a/test/statsCases/preset-normal/expected.txt b/test/statsCases/preset-normal/expected.txt index 1fafbce3e..89ef4e41f 100644 --- a/test/statsCases/preset-normal/expected.txt +++ b/test/statsCases/preset-normal/expected.txt @@ -1,10 +1,10 @@ -Hash: a181afd92c30187a0eba +Hash: 5a6d9c01f46a5330eee6 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.js 152 bytes 0 [emitted] 1.js 289 bytes 1 [emitted] -main.js 7.01 KiB 2 [emitted] main +main.js 7.28 KiB 2 [emitted] main 3.js 227 bytes 3 [emitted] Entrypoint main = main.js [0] ./d.js 22 bytes {3} [built] diff --git a/test/statsCases/preset-verbose/expected.txt b/test/statsCases/preset-verbose/expected.txt index a013e663b..5f0db8b99 100644 --- a/test/statsCases/preset-verbose/expected.txt +++ b/test/statsCases/preset-verbose/expected.txt @@ -1,10 +1,10 @@ -Hash: a181afd92c30187a0eba +Hash: 5a6d9c01f46a5330eee6 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Asset Size Chunks Chunk Names 0.js 152 bytes 0 [emitted] 1.js 289 bytes 1 [emitted] -main.js 7.01 KiB 2 [emitted] main +main.js 7.28 KiB 2 [emitted] main 3.js 227 bytes 3 [emitted] Entrypoint main = main.js chunk {0} 0.js 22 bytes <{2}> [rendered] diff --git a/test/statsCases/scope-hoisting-bailouts/expected.txt b/test/statsCases/scope-hoisting-bailouts/expected.txt index 464871507..93abd0711 100644 --- a/test/statsCases/scope-hoisting-bailouts/expected.txt +++ b/test/statsCases/scope-hoisting-bailouts/expected.txt @@ -1,4 +1,4 @@ -Hash: 123228577e0595ae0a8e +Hash: ee60eae5100628922748 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint index = index.js diff --git a/test/statsCases/scope-hoisting-multi/expected.txt b/test/statsCases/scope-hoisting-multi/expected.txt index 14805f624..93efc61d5 100644 --- a/test/statsCases/scope-hoisting-multi/expected.txt +++ b/test/statsCases/scope-hoisting-multi/expected.txt @@ -1,6 +1,6 @@ -Hash: 1e05cb63c83229a31d7fe3bbe6aa8fb8e8ec3bd9 +Hash: 33704ebeb245a82a7e824bf53c5eb877060bfd4d Child - Hash: 1e05cb63c83229a31d7f + Hash: 33704ebeb245a82a7e82 Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint first = vendor.js first.js @@ -17,7 +17,7 @@ Child [9] ./module_first.js 31 bytes {4} [built] [10] ./second.js 177 bytes {5} [built] Child - Hash: e3bbe6aa8fb8e8ec3bd9 + Hash: 4bf53c5eb877060bfd4d Time: Xms Built at: Thu Jan 01 1970 00:00:00 GMT Entrypoint first = vendor.js first.js