diff --git a/declarations.d.ts b/declarations.d.ts index d8ec8170b..e2200af41 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -7,6 +7,15 @@ declare namespace NodeJS { } } +// TODO remove when https://github.com/DefinitelyTyped/DefinitelyTyped/pull/38753 is merged +declare module "util" { + function deprecate( + fn: T, + message: string, + code?: string + ): T; +} + declare module "neo-async" { interface QueueObject { push(item: T): void; diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts index ebebfdb60..3250790c5 100644 --- a/declarations/WebpackOptions.d.ts +++ b/declarations/WebpackOptions.d.ts @@ -552,6 +552,10 @@ export interface Experiments { * Support .mjs files as way to define strict ESM file (node.js) */ mjs?: boolean; + /** + * Allow outputing javascript files as module source type + */ + outputModule?: boolean; /** * Support WebAssembly as synchronous EcmaScript Module (outdated) */ @@ -1237,6 +1241,10 @@ export interface OutputOptions { * The filename of the Hot Update Main File. It is inside the `output.path` directory. */ hotUpdateMainFilename?: string; + /** + * Wrap javascript code into IIFEs to avoid leaking into global scope. + */ + iife?: boolean; /** * The JSONP function used by webpack for async loading of chunks. */ @@ -1258,6 +1266,7 @@ export interface OutputOptions { */ libraryTarget?: | "var" + | "module" | "assign" | "this" | "window" @@ -1272,6 +1281,10 @@ export interface OutputOptions { | "umd2" | "jsonp" | "system"; + /** + * Output javascript files as module source type. + */ + module?: boolean; /** * The output directory as **absolute path** (required). */ diff --git a/examples/module/README.md b/examples/module/README.md new file mode 100644 index 000000000..1cc1f571b --- /dev/null +++ b/examples/module/README.md @@ -0,0 +1,117 @@ +# example.js + +```javascript +import { increment as inc, value } from "./counter"; +import { resetCounter, print } from "./methods"; +print(value); +inc(); +inc(); +inc(); +print(value); +resetCounter(); +print(value); +``` + +# methods.js + +```javascript +export { reset as resetCounter } from "./counter"; + +export const print = value => console.log(value); +``` + +# counter.js + +```javascript +export let value = 0; +export function increment() { + value++; +} +export function decrement() { + value--; +} +export function reset() { + value = 0; +} +``` + +# dist/output.js + +```javascript +/******/ "use strict"; +/*!********************************!*\ + !*** ./example.js + 2 modules ***! + \********************************/ +/*! exports [not provided] [unused] */ +/*! runtime requirements: supports-symbols-deconflicting */ + +// CONCATENATED MODULE: ./counter.js +let value = 0; +function increment() { + value++; +} +function decrement() { + value--; +} +function counter_reset() { + value = 0; +} + +// CONCATENATED MODULE: ./methods.js + + +const print = value => console.log(value); + +// CONCATENATED MODULE: ./example.js + + +print(value); +increment(); +increment(); +increment(); +print(value); +counter_reset(); +print(value); +``` + +# dist/output.js (production) + +```javascript +let o=0;function n(){o++}const c=o=>console.log(o);c(o),n(),n(),n(),c(o),c(o=0); +``` + +# Info + +## Unoptimized + +``` +Hash: 0a1b2c3d4e5f6a7b8c9d +Version: webpack 5.0.0-alpha.30 + Asset Size Chunks Chunk Names +output.js 621 bytes {0} [emitted] main +Entrypoint main = output.js +chunk {0} output.js (main) 429 bytes [entry] [rendered] + > ./example.js main + [0] ./example.js + 2 modules 429 bytes {0} [built] + [no exports] + [no exports used] + entry ./example.js main + used a library export +``` + +## Production mode + +``` +Hash: 0a1b2c3d4e5f6a7b8c9d +Version: webpack 5.0.0-alpha.30 + Asset Size Chunks Chunk Names +output.js 80 bytes {179} [emitted] main +Entrypoint main = output.js +chunk {179} output.js (main) 429 bytes [entry] [rendered] + > ./example.js main + [291] ./example.js + 2 modules 429 bytes {179} [built] + [no exports] + [no exports used] + entry ./example.js main + used a library export +``` diff --git a/examples/module/async-loaded.js b/examples/module/async-loaded.js new file mode 100644 index 000000000..96100aefe --- /dev/null +++ b/examples/module/async-loaded.js @@ -0,0 +1 @@ +export var answer = 42; diff --git a/examples/module/build.js b/examples/module/build.js new file mode 100644 index 000000000..41c29c9d1 --- /dev/null +++ b/examples/module/build.js @@ -0,0 +1 @@ +require("../build-common"); \ No newline at end of file diff --git a/examples/module/counter.js b/examples/module/counter.js new file mode 100644 index 000000000..7009896e2 --- /dev/null +++ b/examples/module/counter.js @@ -0,0 +1,10 @@ +export let value = 0; +export function increment() { + value++; +} +export function decrement() { + value--; +} +export function reset() { + value = 0; +} diff --git a/examples/module/example.js b/examples/module/example.js new file mode 100644 index 000000000..ec782d967 --- /dev/null +++ b/examples/module/example.js @@ -0,0 +1,9 @@ +import { increment as inc, value } from "./counter"; +import { resetCounter, print } from "./methods"; +print(value); +inc(); +inc(); +inc(); +print(value); +resetCounter(); +print(value); diff --git a/examples/module/methods.js b/examples/module/methods.js new file mode 100644 index 000000000..4be8f10f7 --- /dev/null +++ b/examples/module/methods.js @@ -0,0 +1,3 @@ +export { reset as resetCounter } from "./counter"; + +export const print = value => console.log(value); diff --git a/examples/module/template.md b/examples/module/template.md new file mode 100644 index 000000000..98d06e62e --- /dev/null +++ b/examples/module/template.md @@ -0,0 +1,43 @@ +# example.js + +```javascript +_{{example.js}}_ +``` + +# methods.js + +```javascript +_{{methods.js}}_ +``` + +# counter.js + +```javascript +_{{counter.js}}_ +``` + +# dist/output.js + +```javascript +_{{dist/output.js}}_ +``` + +# dist/output.js (production) + +```javascript +_{{production:dist/output.js}}_ +``` + +# Info + +## Unoptimized + +``` +_{{stdout}}_ +``` + +## Production mode + +``` +_{{production:stdout}}_ +``` diff --git a/examples/module/webpack.config.js b/examples/module/webpack.config.js new file mode 100644 index 000000000..f354df368 --- /dev/null +++ b/examples/module/webpack.config.js @@ -0,0 +1,12 @@ +module.exports = { + output: { + module: true + }, + optimization: { + usedExports: true, + concatenateModules: true + }, + experiments: { + outputModule: true + } +}; diff --git a/lib/CodeGenerationError.js b/lib/CodeGenerationError.js new file mode 100644 index 000000000..144afe0ee --- /dev/null +++ b/lib/CodeGenerationError.js @@ -0,0 +1,31 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +const WebpackError = require("./WebpackError"); + +/** @typedef {import("./Module")} Module */ + +class CodeGenerationError extends WebpackError { + /** + * Create a new CodeGenerationError + * @param {Module} module related module + * @param {Error} error Original error + */ + constructor(module, error) { + super(); + + this.name = "CodeGenerationError"; + this.error = error; + this.message = error.message; + this.details = error.stack; + this.module = module; + + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = CodeGenerationError; diff --git a/lib/Compilation.js b/lib/Compilation.js index d5f171dc5..c836d43da 100644 --- a/lib/Compilation.js +++ b/lib/Compilation.js @@ -20,6 +20,7 @@ const ChunkGraph = require("./ChunkGraph"); const ChunkGroup = require("./ChunkGroup"); const ChunkRenderError = require("./ChunkRenderError"); const ChunkTemplate = require("./ChunkTemplate"); +const CodeGenerationError = require("./CodeGenerationError"); const DependencyTemplates = require("./DependencyTemplates"); const Entrypoint = require("./Entrypoint"); const ErrorHelpers = require("./ErrorHelpers"); @@ -65,6 +66,7 @@ const { arrayToSetDeprecation } = require("./util/deprecation"); /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */ /** @typedef {import("./DependencyTemplate")} DependencyTemplate */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./ModuleFactory")} ModuleFactory */ /** @typedef {import("./RuntimeModule")} RuntimeModule */ /** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */ @@ -372,6 +374,11 @@ class Compilation { /** @type {SyncHook<[]>} */ afterModuleHash: new SyncHook([]), + /** @type {SyncHook<[]>} */ + beforeCodeGeneration: new SyncHook([]), + /** @type {SyncHook<[]>} */ + afterCodeGeneration: new SyncHook([]), + /** @type {SyncHook<[]>} */ beforeRuntimeRequirements: new SyncHook([]), /** @type {SyncHook<[]>} */ @@ -516,6 +523,8 @@ class Compilation { this.moduleGraph = new ModuleGraph(); this.chunkGraph = undefined; + /** @type {Map} */ + this.codeGenerationResults = undefined; /** @type {AsyncQueue} */ this.factorizeQueue = new AsyncQueue({ @@ -1453,6 +1462,10 @@ class Compilation { this.createModuleHashes(); this.hooks.afterModuleHash.call(); + this.hooks.beforeCodeGeneration.call(); + this.codeGenerationResults = this.codeGeneration(); + this.hooks.afterCodeGeneration.call(); + this.hooks.beforeRuntimeRequirements.call(); this.processRuntimeRequirements(this.entrypoints.values()); this.hooks.afterRuntimeRequirements.call(); @@ -1563,30 +1576,51 @@ class Compilation { } } + codeGeneration() { + const { + chunkGraph, + moduleGraph, + dependencyTemplates, + runtimeTemplate + } = this; + const results = new Map(); + for (const module of this.modules) { + if (chunkGraph.getNumberOfModuleChunks(module) > 0) { + try { + const r = module.codeGeneration({ + chunkGraph, + moduleGraph, + dependencyTemplates, + runtimeTemplate + }); + results.set(module, r); + } catch (err) { + this.errors.push(new CodeGenerationError(module, err)); + results.set(module, { + sources: new Map(), + runtimeRequirements: null + }); + } + } + } + return results; + } + /** * @param {Iterable} entrypoints the entrypoints * @returns {void} */ processRuntimeRequirements(entrypoints) { - const { - chunkGraph, - moduleGraph, - runtimeTemplate, - dependencyTemplates - } = this; + const { chunkGraph } = this; const additionalModuleRuntimeRequirements = /** @type {TODO} */ (this.hooks .additionalModuleRuntimeRequirements); const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule; for (const module of this.modules) { if (chunkGraph.getNumberOfModuleChunks(module) > 0) { - const runtimeRequirements = module.getRuntimeRequirements({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph - }); let set; + const runtimeRequirements = this.codeGenerationResults.get(module) + .runtimeRequirements; if (runtimeRequirements) { set = new Set(runtimeRequirements); } else if (additionalModuleRuntimeRequirements.isUsed()) { @@ -2201,6 +2235,7 @@ class Compilation { hash: this.hash, fullHash: this.fullHash, outputOptions, + codeGenerationResults: this.codeGenerationResults, moduleTemplates: this.moduleTemplates, dependencyTemplates: this.dependencyTemplates, chunkGraph: this.chunkGraph, diff --git a/lib/ContextModule.js b/lib/ContextModule.js index c19367a56..7975aa852 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -26,9 +26,10 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {import("./ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */ /** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ /** @typedef {import("./RequestShortener")} RequestShortener */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ @@ -882,7 +883,7 @@ module.exports = webpackEmptyAsyncContext;`; /** * @param {string} asyncMode module mode - * @param {SourceContext} sourceContext context info + * @param {CodeGenerationContext} context context info * @returns {string} the source code */ getSourceString(asyncMode, { runtimeTemplate, chunkGraph }) { @@ -943,21 +944,16 @@ module.exports = webpackEmptyAsyncContext;`; } /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - source(sourceContext) { - return this.getSource( - this.getSourceString(this.options.mode, sourceContext) + codeGeneration(context) { + const { chunkGraph } = context; + const sources = new Map(); + sources.set( + "javascript", + this.getSource(this.getSourceString(this.options.mode, context)) ); - } - - /** - * Get a list of runtime requirements - * @param {SourceContext} context context for code generation - * @returns {Iterable | null} required runtime modules - */ - getRuntimeRequirements({ chunkGraph }) { const set = []; const allDeps = /** @type {ContextElementDependency[]} */ (this.dependencies.concat( this.blocks.map(b => b.dependencies[0]) @@ -978,7 +974,10 @@ module.exports = webpackEmptyAsyncContext;`; set.push(RuntimeGlobals.createFakeNamespaceObject); } } - return set; + return { + sources, + runtimeRequirements: set + }; } /** diff --git a/lib/DelegatedModule.js b/lib/DelegatedModule.js index c39dd1299..bca86c986 100644 --- a/lib/DelegatedModule.js +++ b/lib/DelegatedModule.js @@ -16,6 +16,8 @@ const StaticExportsDependency = require("./dependencies/StaticExportsDependency" /** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ /** @typedef {import("./LibManifestPlugin").ManifestModuleData} ManifestModuleData */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ /** @typedef {import("./Module").SourceContext} SourceContext */ @@ -110,10 +112,10 @@ class DelegatedModule extends Module { } /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - source({ runtimeTemplate, moduleGraph, chunkGraph }) { + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { const dep = /** @type {DelegatedSourceDependency} */ (this.dependencies[0]); const sourceModule = moduleGraph.getModule(dep); let str; @@ -142,20 +144,17 @@ class DelegatedModule extends Module { str += ";"; } + const sources = new Map(); if (this.useSourceMap) { - return new OriginalSource(str, this.identifier()); + sources.set("javascript", new OriginalSource(str, this.identifier())); } else { - return new RawSource(str); + sources.set("javascript", new RawSource(str)); } - } - /** - * Get a list of runtime requirements - * @param {SourceContext} context context for code generation - * @returns {Iterable | null} required runtime modules - */ - getRuntimeRequirements(context) { - return [RuntimeGlobals.module, RuntimeGlobals.require]; + return { + sources, + runtimeRequirements: [RuntimeGlobals.module, RuntimeGlobals.require] + }; } /** diff --git a/lib/DllModule.js b/lib/DllModule.js index 92c06b153..c09e267e9 100644 --- a/lib/DllModule.js +++ b/lib/DllModule.js @@ -13,6 +13,8 @@ const RuntimeGlobals = require("./RuntimeGlobals"); /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ /** @typedef {import("./Module").SourceContext} SourceContext */ /** @typedef {import("./RequestShortener")} RequestShortener */ @@ -68,20 +70,19 @@ class DllModule extends Module { } /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - source(sourceContext) { - return new RawSource("module.exports = __webpack_require__;"); - } - - /** - * Get a list of runtime requirements - * @param {SourceContext} context context for code generation - * @returns {Iterable | null} required runtime modules - */ - getRuntimeRequirements(context) { - return [RuntimeGlobals.require, RuntimeGlobals.module]; + codeGeneration(context) { + const sources = new Map(); + sources.set( + "javascript", + new RawSource("module.exports = __webpack_require__;") + ); + return { + sources, + runtimeRequirements: [RuntimeGlobals.require, RuntimeGlobals.module] + }; } /** diff --git a/lib/ExportPropertyTemplatePlugin.js b/lib/ExportPropertyTemplatePlugin.js index cb37e5ae6..3b6411c6e 100644 --- a/lib/ExportPropertyTemplatePlugin.js +++ b/lib/ExportPropertyTemplatePlugin.js @@ -7,6 +7,7 @@ const { ConcatSource } = require("webpack-sources"); const JavascriptModulesPlugin = require("./JavascriptModulesPlugin"); +const { UsageState } = require("./ModuleGraph"); /** @typedef {import("./Compiler")} Compiler */ @@ -21,9 +22,11 @@ const accessorToObjectAccess = accessor => { class ExportPropertyTemplatePlugin { /** * @param {string|string[]} property the name of the property to export + * @param {string} explanation an explanation why this property is used */ - constructor(property) { + constructor(property, explanation) { this.property = property; + this.explanation = explanation; } /** @@ -34,6 +37,27 @@ class ExportPropertyTemplatePlugin { compiler.hooks.thisCompilation.tap( "ExportPropertyTemplatePlugin", compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.seal.tap("ExportPropertyTemplatePlugin", () => { + for (const deps of compilation.entryDependencies.values()) { + const dep = deps[deps.length - 1]; + if (dep) { + const module = moduleGraph.getModule(dep); + if (module) { + const exportsInfo = moduleGraph.getExportInfo( + module, + Array.isArray(this.property) + ? this.property[0] + : this.property + ); + exportsInfo.used = UsageState.Used; + exportsInfo.canMangleUse = false; + moduleGraph.addExtraReason(module, this.explanation); + } + } + } + }); + const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation); hooks.renderWithEntry.tap( diff --git a/lib/ExternalModule.js b/lib/ExternalModule.js index 6e7ea59c3..7eace3a8f 100644 --- a/lib/ExternalModule.js +++ b/lib/ExternalModule.js @@ -16,9 +16,10 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ /** @typedef {import("./RequestShortener")} RequestShortener */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("./WebpackError")} WebpackError */ @@ -192,7 +193,9 @@ class ExternalModule extends Module { */ build(options, compilation, resolver, fs, callback) { this.buildMeta = {}; - this.buildInfo = {}; + this.buildInfo = { + strict: true + }; callback(); } @@ -235,20 +238,27 @@ class ExternalModule extends Module { } /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - source({ runtimeTemplate, moduleGraph, chunkGraph }) { + codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph }) { const sourceString = this.getSourceString( runtimeTemplate, moduleGraph, chunkGraph ); + + const sources = new Map(); if (this.useSourceMap) { - return new OriginalSource(sourceString, this.identifier()); + sources.set( + "javascript", + new OriginalSource(sourceString, this.identifier()) + ); } else { - return new RawSource(sourceString); + sources.set("javascript", new RawSource(sourceString)); } + + return { sources, runtimeRequirements: [RuntimeGlobals.module] }; } /** @@ -259,15 +269,6 @@ class ExternalModule extends Module { return 42; } - /** - * Get a list of runtime requirements - * @param {SourceContext} context context for code generation - * @returns {Iterable | null} required runtime modules - */ - getRuntimeRequirements(context) { - return [RuntimeGlobals.module]; - } - /** * @param {Hash} hash the hash used to track dependencies * @param {ChunkGraph} chunkGraph the chunk graph diff --git a/lib/FlagDependencyUsagePlugin.js b/lib/FlagDependencyUsagePlugin.js index 558e74065..62418ae11 100644 --- a/lib/FlagDependencyUsagePlugin.js +++ b/lib/FlagDependencyUsagePlugin.js @@ -7,7 +7,7 @@ const { UsageState } = require("./ModuleGraph"); const { STAGE_DEFAULT } = require("./OptimizationStages"); -const { NS_OBJECT_IMPORTED } = require("./dependencies/DependencyReference"); +const { NO_IMPORTED_NAMES } = require("./dependencies/DependencyReference"); const Queue = require("./util/Queue"); /** @typedef {import("./Compiler")} Compiler */ @@ -143,7 +143,8 @@ class FlagDependencyUsagePlugin { for (const dep of deps) { const module = moduleGraph.getModule(dep); if (module) { - processModule(module, NS_OBJECT_IMPORTED); + processModule(module, NO_IMPORTED_NAMES); + queue.enqueue(module); } } } diff --git a/lib/FlagEntryExportAsUsedPlugin.js b/lib/FlagEntryExportAsUsedPlugin.js new file mode 100644 index 000000000..2ac1ce448 --- /dev/null +++ b/lib/FlagEntryExportAsUsedPlugin.js @@ -0,0 +1,46 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +"use strict"; + +/** @typedef {import("./Compiler")} Compiler */ + +class FlagEntryExportAsUsedPlugin { + constructor(nsObjectUsed, explanation) { + this.nsObjectUsed = nsObjectUsed; + this.explanation = explanation; + } + + /** + * @param {Compiler} compiler webpack compiler + * @returns {void} + */ + apply(compiler) { + compiler.hooks.thisCompilation.tap( + "FlagEntryExportAsUsedPlugin", + compilation => { + const moduleGraph = compilation.moduleGraph; + compilation.hooks.seal.tap("FlagEntryExportAsUsedPlugin", () => { + for (const deps of compilation.entryDependencies.values()) { + for (const dep of deps) { + const module = moduleGraph.getModule(dep); + if (module) { + const exportsInfo = moduleGraph.getExportsInfo(module); + if (this.nsObjectUsed) { + exportsInfo.setUsedInUnknownWay(); + } else { + exportsInfo.setAllKnownExportsUsed(); + } + moduleGraph.addExtraReason(module, this.explanation); + } + } + } + }); + } + ); + } +} + +module.exports = FlagEntryExportAsUsedPlugin; diff --git a/lib/HotModuleReplacementPlugin.js b/lib/HotModuleReplacementPlugin.js index 04ff94367..408fe9627 100644 --- a/lib/HotModuleReplacementPlugin.js +++ b/lib/HotModuleReplacementPlugin.js @@ -343,6 +343,7 @@ class HotModuleReplacementPlugin { outputOptions: compilation.outputOptions, moduleTemplates: compilation.moduleTemplates, dependencyTemplates: compilation.dependencyTemplates, + codeGenerationResults: compilation.codeGenerationResults, runtimeTemplate: compilation.runtimeTemplate, moduleGraph: compilation.moduleGraph, chunkGraph diff --git a/lib/JavascriptModulesPlugin.js b/lib/JavascriptModulesPlugin.js index 7dac6910b..2bfc3b5da 100644 --- a/lib/JavascriptModulesPlugin.js +++ b/lib/JavascriptModulesPlugin.js @@ -9,7 +9,8 @@ const { SyncWaterfallHook, SyncHook } = require("tapable"); const { ConcatSource, OriginalSource, - PrefixSource + PrefixSource, + RawSource } = require("webpack-sources"); const Compilation = require("./Compilation"); const { tryRunOrWebpackError } = require("./HookWebpackError"); @@ -28,6 +29,7 @@ const createHash = require("./util/createHash"); /** @typedef {import("./Compiler")} Compiler */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("./util/Hash")} Hash */ @@ -55,6 +57,7 @@ const chunkHasJs = (chunk, chunkGraph) => { * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph * @property {ChunkGraph} chunkGraph the chunk graph + * @property {Map} codeGenerationResults results of code generation */ /** @@ -64,6 +67,7 @@ const chunkHasJs = (chunk, chunkGraph) => { * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph * @property {ChunkGraph} chunkGraph the chunk graph + * @property {Map} codeGenerationResults results of code generation * @property {string} hash hash to be used for render call */ @@ -131,6 +135,10 @@ class JavascriptModulesPlugin { return hooks; } + constructor(options = {}) { + this.options = options; + } + /** * @param {Compiler} compiler webpack compiler * @returns {void} @@ -174,12 +182,14 @@ class JavascriptModulesPlugin { "JavascriptModulesPlugin", (result, options) => { const { + hash, chunk, chunkGraph, moduleGraph, runtimeTemplate, dependencyTemplates, - outputOptions + outputOptions, + codeGenerationResults } = options; const hotUpdateChunk = @@ -197,13 +207,12 @@ class JavascriptModulesPlugin { dependencyTemplates, runtimeTemplate, moduleGraph, - chunkGraph + chunkGraph, + codeGenerationResults }, hooks ); } else if (chunk.hasRuntime()) { - const hash = options.hash; - filenameTemplate = chunk.filenameTemplate || outputOptions.filename; @@ -215,7 +224,8 @@ class JavascriptModulesPlugin { dependencyTemplates, runtimeTemplate, moduleGraph, - chunkGraph + chunkGraph, + codeGenerationResults }, hooks ); @@ -239,7 +249,8 @@ class JavascriptModulesPlugin { dependencyTemplates, runtimeTemplate, moduleGraph, - chunkGraph + chunkGraph, + codeGenerationResults }, hooks ); @@ -249,6 +260,7 @@ class JavascriptModulesPlugin { render, filenameTemplate, pathOptions: { + hash, chunk, contentHashType: "javascript" }, @@ -278,8 +290,12 @@ class JavascriptModulesPlugin { ); for (const key of Object.keys(bootstrap)) { hash.update(key); - for (const line of bootstrap[key]) { - hash.update(line); + if (Array.isArray(bootstrap[key])) { + for (const line of bootstrap[key]) { + hash.update(line); + } + } else { + hash.update(JSON.stringify(bootstrap[key])); } } } @@ -329,66 +345,70 @@ class JavascriptModulesPlugin { * @param {Module} module the rendered module * @param {RenderContext} renderContext options object * @param {CompilationHooks} hooks hooks + * @param {boolean | "strict"} factory true: renders as factory method, "strict": renders as factory method already in strict scope, false: pure module content * @returns {Source} the newly generated source from rendering */ - renderModule(module, renderContext, hooks) { + renderModule(module, renderContext, hooks, factory) { const { chunkGraph, - moduleGraph, runtimeTemplate, - dependencyTemplates + codeGenerationResults } = renderContext; try { - const moduleSource = module.source({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - type: "javascript" - }); + const moduleSource = codeGenerationResults + .get(module) + .sources.get("javascript"); + if (!moduleSource) return null; const moduleSourcePostContent = tryRunOrWebpackError( () => hooks.renderModuleContent.call(moduleSource, module, renderContext), "JavascriptModulesPlugin.getCompilationHooks().renderModuleContent" ); - const source = new ConcatSource(); - const args = []; - const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( - module - ); - const needModule = runtimeRequirements.has(RuntimeGlobals.module); - const needExports = runtimeRequirements.has(RuntimeGlobals.exports); - const needRequire = - runtimeRequirements.has(RuntimeGlobals.require) || - runtimeRequirements.has(RuntimeGlobals.requireScope); - const needThisAsExports = runtimeRequirements.has( - RuntimeGlobals.thisAsExports - ); - if (needExports || needRequire || needModule) - args.push( - needModule - ? module.moduleArgument - : "__unused_webpack_" + module.moduleArgument + let moduleSourcePostContainer; + if (factory) { + const source = new ConcatSource(); + const args = []; + const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements( + module ); - if (needExports || needRequire) - args.push( - needExports - ? module.exportsArgument - : "__unused_webpack_" + module.exportsArgument + const needModule = runtimeRequirements.has(RuntimeGlobals.module); + const needExports = runtimeRequirements.has(RuntimeGlobals.exports); + const needRequire = + runtimeRequirements.has(RuntimeGlobals.require) || + runtimeRequirements.has(RuntimeGlobals.requireScope); + const needThisAsExports = runtimeRequirements.has( + RuntimeGlobals.thisAsExports + ); + if (needExports || needRequire || needModule) + args.push( + needModule + ? module.moduleArgument + : "__unused_webpack_" + module.moduleArgument + ); + if (needExports || needRequire) + args.push( + needExports + ? module.exportsArgument + : "__unused_webpack_" + module.exportsArgument + ); + if (needRequire) args.push("__webpack_require__"); + if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) { + source.add("/***/ ((" + args.join(", ") + ") => {\n\n"); + } else { + source.add("/***/ (function(" + args.join(", ") + ") {\n\n"); + } + if (module.buildInfo.strict && factory !== "strict") { + source.add('"use strict";\n'); + } + source.add(moduleSourcePostContent); + source.add("\n\n/***/ })"); + moduleSourcePostContainer = tryRunOrWebpackError( + () => hooks.renderModuleContainer.call(source, module, renderContext), + "JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer" ); - if (needRequire) args.push("__webpack_require__"); - if (!needThisAsExports && runtimeTemplate.supportsArrowFunction()) { - source.add("/***/ ((" + args.join(", ") + ") => {\n\n"); } else { - source.add("/***/ (function(" + args.join(", ") + ") {\n\n"); + moduleSourcePostContainer = moduleSourcePostContent; } - if (module.buildInfo.strict) source.add('"use strict";\n'); - source.add(moduleSourcePostContent); - source.add("\n\n/***/ })"); - const moduleSourcePostContainer = tryRunOrWebpackError( - () => hooks.renderModuleContainer.call(source, module, renderContext), - "JavascriptModulesPlugin.getCompilationHooks().renderModuleContainer" - ); return tryRunOrWebpackError( () => hooks.renderModulePackage.call( @@ -410,12 +430,14 @@ class JavascriptModulesPlugin { * @returns {Source} the rendered source */ renderChunk(renderContext, hooks) { - const chunk = renderContext.chunk; - const moduleSources = Template.renderChunkModules( - renderContext, - m => m.getSourceTypes().has("javascript"), - module => this.renderModule(module, renderContext, hooks) - ); + const { chunk, chunkGraph } = renderContext; + const modules = chunkGraph + .getOrderedChunkModules(chunk, compareModulesByIdOrIdentifier(chunkGraph)) + .filter(m => m.getSourceTypes().has("javascript")); + const moduleSources = + Template.renderChunkModules(renderContext, modules, module => + this.renderModule(module, renderContext, hooks, true) + ) || new RawSource("{}"); let source = tryRunOrWebpackError( () => hooks.renderChunk.call(moduleSources, renderContext), "JavascriptModulesPlugin.getCompilationHooks().renderChunk" @@ -438,38 +460,78 @@ class JavascriptModulesPlugin { renderMain(renderContext, hooks) { const { chunk, chunkGraph, runtimeTemplate } = renderContext; - let source = new ConcatSource(); - if (runtimeTemplate.supportsConst()) { - source.add("/******/ (() => { // webpackBootstrap\n"); - } else { - source.add("/******/ (function() { // webpackBootstrap\n"); - } - - source.add("/******/ \tvar __webpack_modules__ = ("); - source.add( - Template.renderChunkModules( - renderContext, - m => m.getSourceTypes().has("javascript"), - module => this.renderModule(module, renderContext, hooks), - "/******/ \t" - ) - ); - source.add(");\n"); + const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); + const iife = runtimeTemplate.isIIFE(); const bootstrap = this.renderBootstrap(renderContext, hooks); - source.add( - "/************************************************************************/\n" + const allModules = chunkGraph + .getOrderedChunkModules(chunk, compareModulesByIdOrIdentifier(chunkGraph)) + .filter(m => m.getSourceTypes().has("javascript")); + const allStrict = allModules.every(m => m.buildInfo.strict); + + let inlinedModules; + if (bootstrap.allowInlineStartup) { + inlinedModules = new Set(chunkGraph.getChunkEntryModulesIterable(chunk)); + } + + let source = new ConcatSource(); + let prefix; + if (iife) { + if (runtimeTemplate.supportsConst()) { + source.add("/******/ (() => { // webpackBootstrap\n"); + } else { + source.add("/******/ (function() { // webpackBootstrap\n"); + } + prefix = "/******/ \t"; + } else { + prefix = "/******/ "; + } + if (allStrict) { + source.add(prefix + '"use strict";\n'); + } + + const chunkModules = Template.renderChunkModules( + renderContext, + inlinedModules + ? allModules.filter(m => !inlinedModules.has(m)) + : allModules, + module => + this.renderModule( + module, + renderContext, + hooks, + allStrict ? "strict" : true + ), + prefix ); - source.add( - new PrefixSource( - "/******/", - new OriginalSource( - Template.prefix(bootstrap.header, " \t") + "\n", - "webpack/bootstrap" + if ( + chunkModules || + runtimeRequirements.has(RuntimeGlobals.moduleFactories) || + runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) + ) { + source.add(prefix + "var __webpack_modules__ = ("); + source.add(chunkModules || "{}"); + source.add(");\n"); + source.add( + "/************************************************************************/\n" + ); + } + + if (bootstrap.header.length > 0) { + source.add( + new PrefixSource( + prefix, + new OriginalSource( + Template.asString(bootstrap.header) + "\n", + "webpack/bootstrap" + ) ) - ) - ); + ); + source.add( + "/************************************************************************/\n" + ); + } const runtimeModules = renderContext.chunkGraph.getChunkRuntimeModulesInOrder( chunk @@ -477,25 +539,51 @@ class JavascriptModulesPlugin { if (runtimeModules.length > 0) { source.add( - "/************************************************************************/\n" + new PrefixSource( + prefix, + Template.renderRuntimeModules(runtimeModules, renderContext) + ) ); source.add( - Template.renderMainRuntimeModules(runtimeModules, renderContext) + "/************************************************************************/\n" ); } - source.add( - "/************************************************************************/\n" - ); - source.add( - new PrefixSource( - "/******/", - new OriginalSource( - Template.prefix(bootstrap.startup, " \t") + "\n", - "webpack/startup" + if (inlinedModules) { + for (const m of inlinedModules) { + const renderedModule = this.renderModule( + m, + renderContext, + hooks, + false + ); + if (renderedModule) { + const innerStrict = !allStrict && m.buildInfo.strict; + const iife = innerStrict || inlinedModules.size > 1 || chunkModules; + if (iife) { + source.add("!function() {\n"); + if (innerStrict) source.add('"use strict";\n'); + source.add(renderedModule); + source.add("\n}();\n"); + } else { + source.add(renderedModule); + source.add("\n"); + } + } + } + } else { + source.add( + new PrefixSource( + prefix, + new OriginalSource( + Template.asString(bootstrap.startup) + "\n", + "webpack/startup" + ) ) - ) - ); - source.add("/******/ })()\n"); + ); + } + if (iife) { + source.add("/******/ })()\n"); + } /** @type {Source} */ let finalSource = tryRunOrWebpackError( @@ -519,21 +607,24 @@ class JavascriptModulesPlugin { ); } chunk.rendered = true; - return new ConcatSource(finalSource, ";"); + return iife ? new ConcatSource(finalSource, ";") : finalSource; } /** * @param {RenderBootstrapContext} renderContext options object * @param {CompilationHooks} hooks hooks - * @returns {{ header: string[], startup: string[] }} the generated source of the bootstrap code + * @returns {{ header: string[], startup: string[], allowInlineStartup: boolean }} the generated source of the bootstrap code */ renderBootstrap(renderContext, hooks) { - const { chunkGraph, chunk, runtimeTemplate } = renderContext; + const { chunkGraph, moduleGraph, chunk, runtimeTemplate } = renderContext; const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk); const requireFunction = runtimeRequirements.has(RuntimeGlobals.require); const moduleCache = runtimeRequirements.has(RuntimeGlobals.moduleCache); + const moduleFactories = runtimeRequirements.has( + RuntimeGlobals.moduleFactories + ); const moduleUsed = runtimeRequirements.has(RuntimeGlobals.module); const exportsUsed = runtimeRequirements.has(RuntimeGlobals.exports); const requireScopeUsed = runtimeRequirements.has( @@ -555,12 +646,36 @@ class JavascriptModulesPlugin { const result = { header: [], - startup: [] + startup: [], + allowInlineStartup: true }; let buf = result.header; let startup = result.startup; + if (result.allowInlineStartup && moduleFactories) { + startup.push( + "// module factories are used so entry inlining is disabled" + ); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup && moduleCache) { + startup.push("// module cache are used so entry inlining is disabled"); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup && interceptModuleExecution) { + startup.push( + "// module execution is intercepted so entry inlining is disabled" + ); + result.allowInlineStartup = false; + } + if (result.allowInlineStartup && returnExportsFromRuntime) { + startup.push( + "// module exports must be returned from runtime so entry inlining is disabled" + ); + result.allowInlineStartup = false; + } + if (useRequire || moduleCache) { buf.push("// The module cache"); buf.push("var __webpack_module_cache__ = {};"); @@ -577,27 +692,30 @@ class JavascriptModulesPlugin { } else if (runtimeRequirements.has(RuntimeGlobals.requireScope)) { buf.push("// The require scope"); buf.push("var __webpack_require__ = {};"); + buf.push(""); } - if (runtimeRequirements.has(RuntimeGlobals.moduleFactories)) { - buf.push(""); + if ( + moduleFactories || + runtimeRequirements.has(RuntimeGlobals.moduleFactoriesAddOnly) + ) { buf.push("// expose the modules object (__webpack_modules__)"); buf.push(`${RuntimeGlobals.moduleFactories} = __webpack_modules__;`); + buf.push(""); } if (moduleCache) { - buf.push(""); buf.push("// expose the module cache"); buf.push(`${RuntimeGlobals.moduleCache} = __webpack_module_cache__;`); + buf.push(""); } if (interceptModuleExecution) { - buf.push(""); buf.push("// expose the module execution interceptor"); buf.push(`${RuntimeGlobals.interceptModuleExecution} = [];`); + buf.push(""); } - buf.push(""); if (!runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) { if (chunkGraph.getNumberOfEntryModules(chunk) > 0) { /** @type {string[]} */ @@ -614,15 +732,42 @@ class JavascriptModulesPlugin { for (const entryModule of chunkGraph.getChunkEntryModulesIterable( chunk )) { + if ( + result.allowInlineStartup && + moduleGraph + .getIncomingConnections(entryModule) + .some(c => c.originModule) + ) { + buf2.push( + "// This entry module is referenced by other modules so it can't be inlined" + ); + result.allowInlineStartup = false; + } const mayReturn = --i === 0 && returnExportsFromRuntime ? "return " : ""; const moduleId = chunkGraph.getModuleId(entryModule); + const entryRuntimeRequirements = chunkGraph.getModuleRuntimeRequirements( + entryModule + ); let moduleIdExpr = JSON.stringify(moduleId); if (runtimeRequirements.has(RuntimeGlobals.entryModuleId)) { moduleIdExpr = `${RuntimeGlobals.entryModuleId} = ${moduleIdExpr}`; } if (useRequire) { buf2.push(`${mayReturn}__webpack_require__(${moduleIdExpr});`); + if (result.allowInlineStartup) { + if (entryRuntimeRequirements.has(RuntimeGlobals.module)) { + result.allowInlineStartup = false; + buf2.push( + "// This entry module used 'module' so it can't be inlined" + ); + } else if (entryRuntimeRequirements.has(RuntimeGlobals.exports)) { + buf2.push( + "// This entry module used 'exports' so it can't be inlined" + ); + result.allowInlineStartup = false; + } + } } else if (requireScopeUsed) { buf2.push( `__webpack_modules__[${moduleIdExpr}](0, 0, __webpack_require__);` @@ -632,6 +777,7 @@ class JavascriptModulesPlugin { } } if (runtimeRequirements.has(RuntimeGlobals.startup)) { + result.allowInlineStartup = false; buf.push( Template.asString([ "// the startup function", @@ -641,6 +787,7 @@ class JavascriptModulesPlugin { )};` ]) ); + buf.push(""); startup.push("// run startup"); startup.push(`return ${RuntimeGlobals.startup}();`); } else { @@ -659,8 +806,10 @@ class JavascriptModulesPlugin { )}` ]) ); + buf.push(""); } } else if (runtimeRequirements.has(RuntimeGlobals.startup)) { + result.allowInlineStartup = false; startup.push("// run startup"); startup.push(`return ${RuntimeGlobals.startup}();`); } diff --git a/lib/LibraryTemplatePlugin.js b/lib/LibraryTemplatePlugin.js index 83960c647..b60bd721d 100644 --- a/lib/LibraryTemplatePlugin.js +++ b/lib/LibraryTemplatePlugin.js @@ -83,9 +83,16 @@ class LibraryTemplatePlugin { apply(compiler) { if (this.options.libraryExport) { const ExportPropertyTemplatePlugin = require("./ExportPropertyTemplatePlugin"); - new ExportPropertyTemplatePlugin(this.options.libraryExport).apply( - compiler - ); + new ExportPropertyTemplatePlugin( + this.options.libraryExport, + "used a library export" + ).apply(compiler); + } else { + const FlagEntryExportAsUsedPlugin = require("./FlagEntryExportAsUsedPlugin"); + new FlagEntryExportAsUsedPlugin( + this.options.libraryTarget !== "module", + "used a library export" + ).apply(compiler); } switch (this.options.libraryTarget) { case "umd": @@ -190,6 +197,9 @@ class LibraryTemplatePlugin { }).apply(compiler); break; } + case "module": + // TODO + break; default: throw new Error( `${this.options.libraryTarget} is not a valid Library target` diff --git a/lib/Module.js b/lib/Module.js index d739cb0b5..d1bea0849 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -34,6 +34,20 @@ const makeSerializable = require("./util/makeSerializable"); * @property {string=} type the type of source that should be generated */ +/** + * @typedef {Object} CodeGenerationContext + * @property {DependencyTemplates} dependencyTemplates the dependency templates + * @property {RuntimeTemplate} runtimeTemplate the runtime template + * @property {ModuleGraph} moduleGraph the module graph + * @property {ChunkGraph} chunkGraph the chunk graph + */ + +/** + * @typedef {Object} CodeGenerationResult + * @property {Map} sources the resulting sources for all source types + * @property {Iterable} runtimeRequirements the runtime requirements + */ + /** * @typedef {Object} LibIdentOptions * @property {string} context absolute context path to which lib ident is relative to @@ -522,11 +536,22 @@ class Module extends DependenciesBlock { /** * @abstract + * @deprecated Use codeGeneration() instead * @param {SourceContext} sourceContext source context * @returns {Source} generated source */ source(sourceContext) { - throw new Error("Module.source: Must be overriden"); + if (this.codeGeneration === Module.prototype.codeGeneration) { + throw new Error("Module.source: Must be overriden"); + } + const sources = this.codeGeneration(sourceContext).sources; + return sourceContext.type + ? sources.get(sourceContext.type) + : sources.get( + this.getSourceTypes() + .values() + .next().value + ); } /** @@ -554,12 +579,41 @@ class Module extends DependenciesBlock { } /** + * @abstract + * @deprecated Use codeGeneration() instead * Get a list of runtime requirements * @param {SourceContext} context context for code generation * @returns {Iterable | null} required runtime modules */ getRuntimeRequirements(context) { - return null; + if (this.codeGeneration === Module.prototype.codeGeneration) { + return null; + } + return this.codeGeneration(context).runtimeRequirements; + } + + /** + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result + */ + codeGeneration(context) { + // Best override this method + const sources = new Map(); + for (const type of this.getSourceTypes()) { + if (type !== "unknown") { + sources.set( + type, + this.source({ + ...context, + type + }) + ); + } + } + return { + sources, + runtimeRequirements: this.getRuntimeRequirements(context) + }; } /** diff --git a/lib/ModuleGraph.js b/lib/ModuleGraph.js index 25b6fd65f..2c4e58cf4 100644 --- a/lib/ModuleGraph.js +++ b/lib/ModuleGraph.js @@ -218,6 +218,21 @@ class ExportsInfo { return changed; } + setAllKnownExportsUsed() { + let changed = false; + if (this._isUsed === false) { + this._isUsed = true; + changed = true; + } + for (const exportInfo of this._exports.values()) { + if (exportInfo.used !== UsageState.Used) { + exportInfo.used = UsageState.Used; + changed = true; + } + } + return changed; + } + setUsedAsNamedExportType() { let changed = false; if (this._isUsed === false) { diff --git a/lib/NormalModule.js b/lib/NormalModule.js index 7a00f1f93..7666e4889 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -35,9 +35,10 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ /** @typedef {import("./RequestShortener")} RequestShortener */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("./util/Hash")} Hash */ @@ -90,8 +91,9 @@ makeSerializable( ); /** - * @typedef {Object} CachedSourceEntry + * @typedef {Object} CachedCodeGenerationEntry * @property {string} hash the hash value + * @property {CodeGenerationResult} result result of code generation */ /** @@ -162,8 +164,8 @@ class NormalModule extends Module { this._source = null; /** @private @type {Map} **/ this._sourceSizes = new Map(); - /** @private @type {Map} */ - this._cachedSources = new Map(); + /** @private @type {CachedCodeGenerationEntry} */ + this._cachedCodeGeneration = undefined; // Cache this._lastSuccessfulBuildMeta = {}; @@ -575,7 +577,7 @@ class NormalModule extends Module { }; return this.doBuild(options, compilation, resolver, fs, err => { - this._cachedSources.clear(); + this._cachedCodeGeneration = undefined; // if we have an error mark module as failed and exit if (err) { @@ -659,14 +661,6 @@ class NormalModule extends Module { return `${hash}-${dtHash}`; } - /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source - */ - source(sourceContext) { - return this._generateSource(sourceContext).source; - } - /** * @returns {Set} types availiable (do not mutate) */ @@ -675,31 +669,20 @@ class NormalModule extends Module { } /** - * @typedef {Object} GenerateSourceContext + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - - /** - * @typedef {Object} GenerateSourceResult - * @property {Source} source the generated source - * @property {Set} runtimeRequirements the requirements for the runtime - */ - - /** - * @param {SourceContext} sourceContext source context - * @returns {GenerateSourceResult} generated source result - */ - _generateSource({ + codeGeneration({ dependencyTemplates, runtimeTemplate, moduleGraph, - chunkGraph, - type = "javascript" + chunkGraph }) { const hashDigest = this._getHashDigest(chunkGraph, dependencyTemplates); - const cacheEntry = this._cachedSources.get(type); + const cacheEntry = this._cachedCodeGeneration; if (cacheEntry !== undefined && cacheEntry.hash === hashDigest) { // We can reuse the cached data - return cacheEntry; + return cacheEntry.result; } /** @type {Set} */ @@ -711,32 +694,33 @@ class NormalModule extends Module { runtimeRequirements.add(RuntimeGlobals.thisAsExports); } - const source = this.error - ? new RawSource( - "throw new Error(" + JSON.stringify(this.error.message) + ");" - ) - : this.generator.generate(this, { - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - runtimeRequirements, - type - }); + const sources = new Map(); + for (const type of this.generator.getTypes()) { + const source = this.error + ? new RawSource( + "throw new Error(" + JSON.stringify(this.error.message) + ");" + ) + : this.generator.generate(this, { + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph, + runtimeRequirements, + type + }); - const cachedSource = new CachedSource(source); + sources.set(type, new CachedSource(source)); + } - // TODO remove cast when webpack-sources types are fixed - // CachedSource is not a Source? - const fixedSource = /** @type {TODO} */ (cachedSource); - - /** @type {GenerateSourceResult & CachedSourceEntry} */ + /** @type {CodeGenerationResult} */ const resultEntry = { - source: fixedSource, - runtimeRequirements, + sources, + runtimeRequirements + }; + this._cachedCodeGeneration = { + result: resultEntry, hash: hashDigest }; - this._cachedSources.set(type, resultEntry); return resultEntry; } @@ -775,15 +759,6 @@ class NormalModule extends Module { }); } - /** - * Get a list of runtime requirements - * @param {SourceContext} context context for code generation - * @returns {Iterable | null} required runtime modules - */ - getRuntimeRequirements(context) { - return this._generateSource(context).runtimeRequirements; - } - /** * @param {string=} type the source type for which the size should be estimated * @returns {number} the estimated size of the module (must be non-zero) @@ -817,7 +792,7 @@ class NormalModule extends Module { write(this._source); write(this._sourceSizes); write(this.error); - write(this._cachedSources); + write(this._cachedCodeGeneration); write(this._lastSuccessfulBuildMeta); write(this._forceBuild); super.serialize(context); @@ -847,7 +822,7 @@ class NormalModule extends Module { this._source = read(); this._sourceSizes = read(); this.error = read(); - this._cachedSources = read(); + this._cachedCodeGeneration = read(); this._lastSuccessfulBuildMeta = read(); this._forceBuild = read(); super.deserialize(context); diff --git a/lib/ProgressPlugin.js b/lib/ProgressPlugin.js index 44565d2ad..4b5192a6b 100644 --- a/lib/ProgressPlugin.js +++ b/lib/ProgressPlugin.js @@ -273,6 +273,7 @@ class ProgressPlugin { recordModules: "record modules", recordChunks: "record chunks", beforeModuleHash: "module hashing", + beforeCodeGeneration: "code generation", beforeRuntimeRequirements: "runtime requirements", beforeHash: "hashing", afterHash: "after hashing", diff --git a/lib/RawModule.js b/lib/RawModule.js index 199b56df2..6a0490a77 100644 --- a/lib/RawModule.js +++ b/lib/RawModule.js @@ -13,8 +13,9 @@ const makeSerializable = require("./util/makeSerializable"); /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./Compilation")} Compilation */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ /** @typedef {import("./RequestShortener")} RequestShortener */ /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("./WebpackError")} WebpackError */ @@ -89,15 +90,20 @@ class RawModule extends Module { } /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - source(sourceContext) { + codeGeneration(context) { + const sources = new Map(); if (this.useSourceMap) { - return new OriginalSource(this.sourceStr, this.identifier()); + sources.set( + "javascript", + new OriginalSource(this.sourceStr, this.identifier()) + ); } else { - return new RawSource(this.sourceStr); + sources.set("javascript", new RawSource(this.sourceStr)); } + return { sources, runtimeRequirements: null }; } /** diff --git a/lib/RuntimeGlobals.js b/lib/RuntimeGlobals.js index 94166c174..9f98b1db6 100644 --- a/lib/RuntimeGlobals.js +++ b/lib/RuntimeGlobals.js @@ -25,6 +25,11 @@ exports.exports = "__webpack_exports__"; */ exports.thisAsExports = "top-level-this-exports"; +/** + * top-level this need to be the exports object + */ +exports.supportsSymbolsDeconflicting = "supports-symbols-deconflicting"; + /** * top-level this need to be the exports object */ @@ -55,6 +60,11 @@ exports.moduleCache = "__webpack_require__.c"; */ exports.moduleFactories = "__webpack_require__.m"; +/** + * the module functions, with only write access + */ +exports.moduleFactoriesAddOnly = "__webpack_require__.m (add only)"; + /** * the chunk ensure function */ diff --git a/lib/RuntimeModule.js b/lib/RuntimeModule.js index fc9c40b17..4a44a6d84 100644 --- a/lib/RuntimeModule.js +++ b/lib/RuntimeModule.js @@ -12,14 +12,15 @@ const Module = require("./Module"); /** @typedef {import("./Chunk")} Chunk */ /** @typedef {import("./ChunkGraph")} ChunkGraph */ /** @typedef {import("./Compilation")} Compilation */ +/** @typedef {import("./Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./Module").LibIdentOptions} LibIdentOptions */ /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */ -/** @typedef {import("./Module").SourceContext} SourceContext */ /** @typedef {import("./RequestShortener")} RequestShortener */ /** @typedef {import("./WebpackError")} WebpackError */ /** @typedef {import("./util/Hash")} Hash */ -/** @typedef {SourceContext} GenerateContext */ +/** @typedef {CodeGenerationContext} GenerateContext */ const TYPES = new Set(["runtime"]); @@ -114,13 +115,22 @@ class RuntimeModule extends Module { } /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - source(sourceContext) { + codeGeneration(context) { + const sources = new Map(); const generatedCode = this.getGeneratedCode(); - if (!generatedCode) return null; - return new OriginalSource(generatedCode, this.identifier()); + if (generatedCode) { + sources.set( + "runtime", + new OriginalSource(generatedCode, this.identifier()) + ); + } + return { + sources, + runtimeRequirements: null + }; } /** diff --git a/lib/RuntimePlugin.js b/lib/RuntimePlugin.js index bd2bf8006..2a5e05aa6 100644 --- a/lib/RuntimePlugin.js +++ b/lib/RuntimePlugin.js @@ -34,6 +34,7 @@ const GLOBALS_ON_REQUIRE = [ RuntimeGlobals.makeNamespaceObject, RuntimeGlobals.moduleCache, RuntimeGlobals.moduleFactories, + RuntimeGlobals.moduleFactoriesAddOnly, RuntimeGlobals.interceptModuleExecution, RuntimeGlobals.publicPath, RuntimeGlobals.scriptNonce, diff --git a/lib/RuntimeTemplate.js b/lib/RuntimeTemplate.js index e9e9f4165..d265ad833 100644 --- a/lib/RuntimeTemplate.js +++ b/lib/RuntimeTemplate.js @@ -35,6 +35,10 @@ class RuntimeTemplate { this.requestShortener = requestShortener; } + isIIFE() { + return this.outputOptions.iife; + } + supportsConst() { return this.outputOptions.ecmaVersion >= 2015; } diff --git a/lib/Template.js b/lib/Template.js index 5408760dd..3699639e0 100644 --- a/lib/Template.js +++ b/lib/Template.js @@ -7,10 +7,7 @@ const { ConcatSource, PrefixSource } = require("webpack-sources"); const HotUpdateChunk = require("./HotUpdateChunk"); -const { - compareIds, - compareModulesByIdOrIdentifier -} = require("./util/comparators"); +const { compareIds } = require("./util/comparators"); /** @typedef {import("webpack-sources").ConcatSource} ConcatSource */ /** @typedef {import("webpack-sources").Source} Source */ @@ -20,6 +17,7 @@ const { /** @typedef {import("./Compilation").PathData} PathData */ /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ /** @typedef {import("./Module")} Module */ +/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("./ModuleGraph")} ModuleGraph */ /** @typedef {import("./ModuleTemplate")} ModuleTemplate */ /** @typedef {import("./ModuleTemplate").RenderContext} RenderContext */ @@ -44,6 +42,7 @@ const MATCH_PADDED_HYPHENS_REPLACE_REGEX = /^-|-$/g; * @property {string} hash * @property {string} fullHash * @property {TODO} outputOptions + * @property {Map} codeGenerationResults * @property {{javascript: ModuleTemplate}} moduleTemplates * @property {DependencyTemplates} dependencyTemplates * @property {RuntimeTemplate} runtimeTemplate @@ -225,22 +224,14 @@ class Template { /** * @param {RenderContext} renderContext render context - * @param {ModuleFilterPredicate} filterFn function used to filter modules from chunk to render + * @param {Module[]} modules modules to render * @param {function(Module): Source} renderModule function to render a module * @param {string=} prefix applying prefix strings * @returns {Source} rendered chunk modules in a Source object */ - static renderChunkModules( - renderContext, - filterFn, - renderModule, - prefix = "" - ) { + static renderChunkModules(renderContext, modules, renderModule, prefix = "") { const { chunk, chunkGraph } = renderContext; var source = new ConcatSource(); - const modules = chunkGraph - .getOrderedChunkModules(chunk, compareModulesByIdOrIdentifier(chunkGraph)) - .filter(filterFn); let removedModules; if (chunk instanceof HotUpdateChunk) { removedModules = chunk.removedModules; @@ -249,14 +240,13 @@ class Template { modules.length === 0 && (!removedModules || removedModules.length === 0) ) { - source.add("[]"); - return source; + return null; } /** @type {{id: string|number, source: Source|string}[]} */ const allModules = modules.map(module => { return { id: chunkGraph.getModuleId(module), - source: renderModule(module) + source: renderModule(module) || "false" }; }); if (removedModules && removedModules.length > 0) { @@ -321,36 +311,26 @@ class Template { static renderRuntimeModules(runtimeModules, renderContext) { const source = new ConcatSource(); for (const module of runtimeModules) { - const moduleSource = module.source({ + const codeGenResult = module.codeGeneration({ chunkGraph: renderContext.chunkGraph, dependencyTemplates: renderContext.dependencyTemplates, moduleGraph: renderContext.moduleGraph, - runtimeTemplate: renderContext.runtimeTemplate, - type: "runtime" + runtimeTemplate: renderContext.runtimeTemplate }); - if (moduleSource) { - source.add(Template.toNormalComment(module.identifier()) + "\n"); - source.add("!function() {\n"); - source.add('\t"use strict";\n'); - source.add(new PrefixSource("\t", moduleSource)); - source.add("\n}();\n\n"); + if (codeGenResult) { + const moduleSource = codeGenResult.sources.get("runtime"); + if (moduleSource) { + source.add(Template.toNormalComment(module.identifier()) + "\n"); + source.add("!function() {\n"); + source.add('\t"use strict";\n'); + source.add(new PrefixSource("\t", moduleSource)); + source.add("\n}();\n\n"); + } } } return source; } - /** - * @param {RuntimeModule[]} runtimeModules array of runtime modules in order - * @param {RenderContext} renderContext render context - * @returns {Source} rendered main runtime modules in a Source object - */ - static renderMainRuntimeModules(runtimeModules, renderContext) { - return new PrefixSource( - "/******/ \t", - this.renderRuntimeModules(runtimeModules, renderContext) - ); - } - /** * @param {RuntimeModule[]} runtimeModules array of runtime modules in order * @param {RenderContext} renderContext render context diff --git a/lib/WebpackOptionsApply.js b/lib/WebpackOptionsApply.js index 5cd7aa817..1cc8630a5 100644 --- a/lib/WebpackOptionsApply.js +++ b/lib/WebpackOptionsApply.js @@ -300,6 +300,19 @@ class WebpackOptionsApply extends OptionsApply { new JavascriptModulesPlugin().apply(compiler); new JsonModulesPlugin().apply(compiler); + if (!options.experiments.outputModule) { + if (options.output.module) { + throw new Error( + "'output.module: true' is only allowed when 'experiements.outputModule' is enabled" + ); + } + if (options.output.libraryTarget === "module") { + throw new Error( + "'output.libraryTarget: \"module\"' is only allowed when 'experiements.outputModule' is enabled" + ); + } + } + if (options.experiments.asset) { const AssetModulesPlugin = require("./asset/AssetModulesPlugin"); new AssetModulesPlugin().apply(compiler); diff --git a/lib/WebpackOptionsDefaulter.js b/lib/WebpackOptionsDefaulter.js index 914131bc8..71eb8cddc 100644 --- a/lib/WebpackOptionsDefaulter.js +++ b/lib/WebpackOptionsDefaulter.js @@ -42,6 +42,7 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { this.set("experiments.topLevelAwait", false); this.set("experiments.syncWebAssembly", false); this.set("experiments.asyncWebAssembly", false); + this.set("experiments.outputModule", false); this.set("entry", "./src"); @@ -199,6 +200,12 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { }); this.set("output.filename", "[name].js"); + this.set( + "output.module", + "make", + options => options.experiments.outputModule + ); + this.set("output.iife", "make", options => !options.output.module); this.set("output.ecmaVersion", 2015); this.set("output.chunkFilename", "make", options => { const filename = options.output.filename; @@ -252,7 +259,9 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { this.set("output.devtoolNamespace", "make", options => { return getDevtoolNamespace(options.output.library); }); - this.set("output.libraryTarget", "var"); + this.set("output.libraryTarget", "make", options => { + return options.output.module ? "module" : "var"; + }); this.set("output.path", path.join(process.cwd(), "dist")); this.set( "output.pathinfo", @@ -263,7 +272,9 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { this.set("output.hotUpdateChunkFilename", "[id].[fullhash].hot-update.js"); this.set("output.hotUpdateMainFilename", "[fullhash].hot-update.json"); this.set("output.crossOriginLoading", false); - this.set("output.jsonpScriptType", false); + this.set("output.jsonpScriptType", "make", options => { + return options.output.module ? "module" : false; + }); this.set("output.chunkLoadTimeout", 120000); this.set("output.hashFunction", "md4"); this.set("output.hashDigest", "hex"); @@ -434,6 +445,7 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { (options.plugins && options.plugins.some(p => p instanceof SourceMapDevToolPlugin)), terserOptions: { + module: options.output.module, ecma: options.output.ecmaVersion > 2000 ? options.output.ecmaVersion - 2009 diff --git a/lib/asset/AssetModulesPlugin.js b/lib/asset/AssetModulesPlugin.js index 1f8ffbc0c..956dfbd0a 100644 --- a/lib/asset/AssetModulesPlugin.js +++ b/lib/asset/AssetModulesPlugin.js @@ -40,8 +40,8 @@ class AssetModulesPlugin { }); compilation.hooks.renderManifest.tap(plugin, (result, options) => { - const { chunkGraph, moduleGraph } = compilation; - const { chunk, dependencyTemplates, runtimeTemplate } = options; + const { chunkGraph } = compilation; + const { chunk, runtimeTemplate, codeGenerationResults } = options; const { outputOptions } = runtimeTemplate; @@ -55,13 +55,7 @@ class AssetModulesPlugin { result.push({ render: () => - module.source({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - type - }), + codeGenerationResults.get(module).sources.get(type), filenameTemplate, pathOptions: { module, diff --git a/lib/node/NodeTemplatePlugin.js b/lib/node/NodeTemplatePlugin.js index 7c30871e1..62f9412f8 100644 --- a/lib/node/NodeTemplatePlugin.js +++ b/lib/node/NodeTemplatePlugin.js @@ -58,7 +58,7 @@ class NodeTemplatePlugin { const handler = (chunk, set) => { if (onceForChunkSet.has(chunk)) return; onceForChunkSet.add(chunk); - set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); compilation.addRuntimeModule(chunk, new ChunkLoadingRuntimeModule(set)); }; @@ -83,7 +83,7 @@ class NodeTemplatePlugin { set.add(RuntimeGlobals.getChunkUpdateScriptFilename); set.add(RuntimeGlobals.moduleCache); set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.hmrDownloadManifest) diff --git a/lib/optimize/ConcatenatedModule.js b/lib/optimize/ConcatenatedModule.js index 57a8a45f8..d74999dac 100644 --- a/lib/optimize/ConcatenatedModule.js +++ b/lib/optimize/ConcatenatedModule.js @@ -6,7 +6,11 @@ "use strict"; const eslintScope = require("eslint-scope"); -const { ConcatSource, ReplaceSource } = require("webpack-sources"); +const { + CachedSource, + ConcatSource, + ReplaceSource +} = require("webpack-sources"); const DependencyTemplate = require("../DependencyTemplate"); const JavascriptParser = require("../JavascriptParser"); const Module = require("../Module"); @@ -33,14 +37,20 @@ const propertyAccess = require("../util/propertyAccess"); /** @typedef {import("../Dependency")} Dependency */ /** @typedef {import("../DependencyTemplate").DependencyTemplateContext} DependencyTemplateContext */ /** @typedef {import("../DependencyTemplates")} DependencyTemplates */ +/** @typedef {import("../Module").CodeGenerationContext} CodeGenerationContext */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ /** @typedef {import("../Module").LibIdentOptions} LibIdentOptions */ -/** @typedef {import("../Module").SourceContext} SourceContext */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../RequestShortener")} RequestShortener */ /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ /** @typedef {import("../WebpackError")} WebpackError */ /** @typedef {import("../util/Hash")} Hash */ +/** + * @typedef {Object} CachedSourceEntry + * @property {string} hash the hash value + */ + /** * @typedef {Object} ReexportInfo * @property {Module} module @@ -58,6 +68,7 @@ const propertyAccess = require("../util/propertyAccess"); * @property {Object} ast * @property {Source} internalSource * @property {ReplaceSource} source + * @property {Iterable} runtimeRequirements * @property {TODO} globalScope * @property {TODO} moduleScope * @property {TODO} internalNames @@ -766,10 +777,20 @@ class ConcatenatedModule extends Module { } /** - * @param {SourceContext} sourceContext source context - * @returns {Source} generated source + * @param {CodeGenerationContext} context context for code generation + * @returns {CodeGenerationResult} result */ - source({ dependencyTemplates, runtimeTemplate, moduleGraph, chunkGraph }) { + codeGeneration({ + dependencyTemplates, + runtimeTemplate, + moduleGraph, + chunkGraph + }) { + /** @type {Set} */ + const runtimeRequirements = new Set([ + RuntimeGlobals.supportsSymbolsDeconflicting + ]); + const requestShortener = runtimeTemplate.requestShortener; // Metainfo for each module const modulesWithInfo = this._getModulesWithInfo(moduleGraph); @@ -985,7 +1006,7 @@ class ConcatenatedModule extends Module { result.add( runtimeTemplate.defineEsModuleFlagStatement({ exportsArgument: this.exportsArgument, - runtimeRequirements: new Set() + runtimeRequirements }) ); } @@ -994,26 +1015,35 @@ class ConcatenatedModule extends Module { for (const info of modulesWithInfo) { if (info.type === "concatenated" && info.namespaceObjectSource) { result.add(info.namespaceObjectSource); + runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject); + runtimeRequirements.add(RuntimeGlobals.definePropertyGetters); } } // evaluate modules in order for (const info of modulesWithInfo) { switch (info.type) { - case "concatenated": + case "concatenated": { result.add( `\n// CONCATENATED MODULE: ${info.module.readableIdentifier( requestShortener )}\n` ); result.add(info.source); + if (info.runtimeRequirements) { + for (const r of info.runtimeRequirements) { + runtimeRequirements.add(r); + } + } break; + } case "external": result.add( `\n// EXTERNAL MODULE: ${info.module.readableIdentifier( requestShortener )}\n` ); + runtimeRequirements.add(RuntimeGlobals.require); result.add( `var ${info.name} = __webpack_require__(${JSON.stringify( chunkGraph.getModuleId(info.module) @@ -1021,16 +1051,19 @@ class ConcatenatedModule extends Module { ); if (info.interopNamespaceObjectUsed) { if (info.module.buildMeta.exportsType === "named") { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); result.add( `var ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${info.name}, 2);\n` ); } else if (!info.module.buildMeta.exportsType) { + runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject); result.add( `var ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${info.name});\n` ); } } if (info.interopDefaultAccessUsed) { + runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport); result.add( `var ${info.interopDefaultAccessName} = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${info.name});\n` ); @@ -1042,7 +1075,10 @@ class ConcatenatedModule extends Module { } } - return result; + return { + sources: new Map([["javascript", new CachedSource(result)]]), + runtimeRequirements + }; } _analyseModule( @@ -1054,12 +1090,13 @@ class ConcatenatedModule extends Module { ) { if (info.type === "concatenated") { const m = info.module; - const source = m.source({ + const codeGenResult = m.codeGeneration({ dependencyTemplates: innerDependencyTemplates, runtimeTemplate, moduleGraph, chunkGraph }); + const source = codeGenResult.sources.get("javascript"); const code = source.source(); let ast; try { @@ -1092,6 +1129,7 @@ class ConcatenatedModule extends Module { const globalScope = scopeManager.acquire(ast); const moduleScope = globalScope.childScopes[0]; const resultSource = new ReplaceSource(source); + info.runtimeRequirements = codeGenResult.runtimeRequirements; info.ast = ast; info.internalSource = source; info.source = resultSource; @@ -1100,6 +1138,17 @@ class ConcatenatedModule extends Module { } } + /** + * @param {ChunkGraph} chunkGraph the chunk graph + * @param {DependencyTemplates} dependencyTemplates dependency templates + * @returns {string} hash + */ + _getHashDigest(chunkGraph, dependencyTemplates) { + const hash = chunkGraph.getModuleHash(this); + const dtHash = dependencyTemplates.getHash(); + return `${hash}-${dtHash}`; + } + /** * @param {ModuleGraph} moduleGraph the module graph * @returns {ModuleInfo[]} module info items @@ -1164,6 +1213,7 @@ class ConcatenatedModule extends Module { index: idx, ast: undefined, internalSource: undefined, + runtimeRequirements: undefined, source: undefined, globalScope: undefined, moduleScope: undefined, @@ -1287,60 +1337,6 @@ class ConcatenatedModule extends Module { return nameWithNumber; } - /** - * Get a list of runtime requirements - * @param {SourceContext} context context for code generation - * @returns {Iterable | null} required runtime modules - */ - getRuntimeRequirements(context) { - const { dependencyTemplates, moduleGraph } = context; - - // Metainfo for each module - const modulesWithInfo = this._getModulesWithInfo(moduleGraph); - - // Create mapping from module to info - const moduleToInfoMap = modulesWithInfoToMap(modulesWithInfo); - - // Configure template decorators for dependencies - const innerDependencyTemplates = this._getInnerDependencyTemplates( - dependencyTemplates, - moduleToInfoMap - ); - - const innerContext = { - ...context, - dependencyTemplates: innerDependencyTemplates - }; - - const set = new Set([ - RuntimeGlobals.exports, // TODO check if really used - RuntimeGlobals.makeNamespaceObject, - RuntimeGlobals.definePropertyGetters - ]); - for (const info of this._orderedConcatenationList) { - switch (info.type) { - case "concatenated": { - const req = info.module.getRuntimeRequirements(innerContext); - if (req) { - for (const r of req) set.add(r); - } - break; - } - case "external": { - if ( - !info.module.buildMeta.exportsType || - info.module.buildMeta.exportsType === "named" - ) { - set.add(RuntimeGlobals.createFakeNamespaceObject); - } - set.add(RuntimeGlobals.compatGetDefaultExport); - break; - } - } - } - return set; - } - /** * @param {Hash} hash the hash used to track dependencies * @param {ChunkGraph} chunkGraph the chunk graph diff --git a/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js b/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js index 8e5271dcc..765183147 100644 --- a/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +++ b/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js @@ -16,11 +16,12 @@ const AsyncWebAssemblyJavascriptGenerator = require("./AsyncWebAssemblyJavascrip const AsyncWebAssemblyParser = require("./AsyncWebAssemblyParser"); /** @typedef {import("webpack-sources").Source} Source */ +/** @typedef {import("../Compilation")} Compilation */ /** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Module")} Module */ -/** @typedef {import("../Compilation")} Compilation */ -/** @typedef {import("../Template").RenderManifestOptions} RenderManifestOptions} */ -/** @typedef {import("../Template").RenderManifestEntry} RenderManifestEntry} */ +/** @typedef {import("../Module").CodeGenerationResult} CodeGenerationResult */ +/** @typedef {import("../Template").RenderManifestEntry} RenderManifestEntry */ +/** @typedef {import("../Template").RenderManifestOptions} RenderManifestOptions */ /** * @typedef {Object} RenderContext @@ -29,6 +30,7 @@ const AsyncWebAssemblyParser = require("./AsyncWebAssemblyParser"); * @property {RuntimeTemplate} runtimeTemplate the runtime template * @property {ModuleGraph} moduleGraph the module graph * @property {ChunkGraph} chunkGraph the chunk graph + * @property {Map} codeGenerationResults results of code generation */ /** @@ -104,9 +106,12 @@ class AsyncWebAssemblyModulesPlugin { "WebAssemblyModulesPlugin", (result, options) => { const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; - const chunk = options.chunk; - const outputOptions = options.outputOptions; - const dependencyTemplates = options.dependencyTemplates; + const { + chunk, + outputOptions, + dependencyTemplates, + codeGenerationResults + } = options; for (const module of chunkGraph.getOrderedChunkModulesIterable( chunk, @@ -125,7 +130,8 @@ class AsyncWebAssemblyModulesPlugin { dependencyTemplates, runtimeTemplate, moduleGraph, - chunkGraph + chunkGraph, + codeGenerationResults }, hooks ), @@ -151,20 +157,11 @@ class AsyncWebAssemblyModulesPlugin { } renderModule(module, renderContext, hooks) { - const { - chunkGraph, - moduleGraph, - runtimeTemplate, - dependencyTemplates - } = renderContext; + const { codeGenerationResults } = renderContext; try { - const moduleSource = module.source({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph, - type: "webassembly" - }); + const moduleSource = codeGenerationResults + .get(module) + .sources.get("webassembly"); return tryRunOrWebpackError( () => hooks.renderModuleContent.call(moduleSource, module, renderContext), diff --git a/lib/wasm/WebAssemblyModulesPlugin.js b/lib/wasm/WebAssemblyModulesPlugin.js index 3559965d9..00f790a31 100644 --- a/lib/wasm/WebAssemblyModulesPlugin.js +++ b/lib/wasm/WebAssemblyModulesPlugin.js @@ -61,10 +61,8 @@ class WebAssemblyModulesPlugin { compilation.hooks.renderManifest.tap( "WebAssemblyModulesPlugin", (result, options) => { - const { moduleGraph, chunkGraph, runtimeTemplate } = compilation; - const chunk = options.chunk; - const outputOptions = options.outputOptions; - const dependencyTemplates = options.dependencyTemplates; + const { chunkGraph } = compilation; + const { chunk, outputOptions, codeGenerationResults } = options; for (const module of chunkGraph.getOrderedChunkModulesIterable( chunk, @@ -76,12 +74,9 @@ class WebAssemblyModulesPlugin { result.push({ render: () => - module.source({ - dependencyTemplates, - runtimeTemplate, - moduleGraph, - chunkGraph - }), + codeGenerationResults + .get(module) + .sources.get("webassembly"), filenameTemplate, pathOptions: { module, diff --git a/lib/web/JsonpTemplatePlugin.js b/lib/web/JsonpTemplatePlugin.js index 626f1c67a..459a0dd76 100644 --- a/lib/web/JsonpTemplatePlugin.js +++ b/lib/web/JsonpTemplatePlugin.js @@ -258,7 +258,7 @@ class JsonpTemplatePlugin { const handler = (chunk, set) => { if (onceForChunkSet.has(chunk)) return; onceForChunkSet.add(chunk); - set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); compilation.addRuntimeModule( chunk, new JsonpChunkLoadingRuntimeModule( @@ -292,7 +292,7 @@ class JsonpTemplatePlugin { set.add(RuntimeGlobals.getChunkUpdateScriptFilename); set.add(RuntimeGlobals.moduleCache); set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.hmrDownloadManifest) diff --git a/lib/webworker/WebWorkerTemplatePlugin.js b/lib/webworker/WebWorkerTemplatePlugin.js index 2efb6867f..3522c7420 100644 --- a/lib/webworker/WebWorkerTemplatePlugin.js +++ b/lib/webworker/WebWorkerTemplatePlugin.js @@ -80,7 +80,7 @@ class WebWorkerTemplatePlugin { const handler = (chunk, set) => { if (onceForChunkSet.has(chunk)) return; onceForChunkSet.add(chunk); - set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); compilation.addRuntimeModule( chunk, new ImportScriptsChunkLoadingRuntimeModule(set) @@ -109,7 +109,7 @@ class WebWorkerTemplatePlugin { set.add(RuntimeGlobals.getChunkUpdateScriptFilename); set.add(RuntimeGlobals.moduleCache); set.add(RuntimeGlobals.hmrModuleData); - set.add(RuntimeGlobals.moduleFactories); + set.add(RuntimeGlobals.moduleFactoriesAddOnly); }); compilation.hooks.runtimeRequirementInTree .for(RuntimeGlobals.hmrDownloadManifest) diff --git a/schemas/WebpackOptions.json b/schemas/WebpackOptions.json index 465854cb3..f01db0a15 100644 --- a/schemas/WebpackOptions.json +++ b/schemas/WebpackOptions.json @@ -118,6 +118,10 @@ "description": "Support .mjs files as way to define strict ESM file (node.js)", "type": "boolean" }, + "outputModule": { + "description": "Allow outputing javascript files as module source type", + "type": "boolean" + }, "syncWebAssembly": { "description": "Support WebAssembly as synchronous EcmaScript Module (outdated)", "type": "boolean" @@ -1223,6 +1227,10 @@ "type": "string", "absolutePath": false }, + "iife": { + "description": "Wrap javascript code into IIFEs to avoid leaking into global scope.", + "type": "boolean" + }, "jsonpFunction": { "description": "The JSONP function used by webpack for async loading of chunks.", "type": "string" @@ -1264,6 +1272,7 @@ "description": "Type of library", "enum": [ "var", + "module", "assign", "this", "window", @@ -1280,6 +1289,10 @@ "system" ] }, + "module": { + "description": "Output javascript files as module source type.", + "type": "boolean" + }, "path": { "description": "The output directory as **absolute path** (required).", "type": "string", diff --git a/test/RawModule.unittest.js b/test/RawModule.unittest.js index 117a6d83c..4fbbb6e19 100644 --- a/test/RawModule.unittest.js +++ b/test/RawModule.unittest.js @@ -1,8 +1,6 @@ "use strict"; const RawModule = require("../lib/RawModule"); -const OriginalSource = require("webpack-sources").OriginalSource; -const RawSource = require("webpack-sources").RawSource; const RequestShortener = require("../lib/RequestShortener"); const path = require("path"); @@ -35,29 +33,4 @@ describe("RawModule", () => { } ); }); - - describe("source", () => { - it( - "returns a new OriginalSource instance with sourceStr attribute and " + - "return value of identifier() function provided as constructor arguments", - () => { - const originalSource = new OriginalSource( - myRawModule.sourceStr, - myRawModule.identifier() - ); - myRawModule.useSourceMap = true; - expect(myRawModule.source()).toEqual(originalSource); - } - ); - - it( - "returns a new RawSource instance with sourceStr attribute provided " + - "as constructor argument if useSourceMap is falsy", - () => { - const rawSource = new RawSource(myRawModule.sourceStr); - myRawModule.useSourceMap = false; - expect(myRawModule.source()).toEqual(rawSource); - } - ); - }); }); diff --git a/test/Stats.test.js b/test/Stats.test.js index 6b7a7a60f..f5a5765ba 100644 --- a/test/Stats.test.js +++ b/test/Stats.test.js @@ -220,10 +220,10 @@ describe("Stats", () => { ], "emitted": true, "info": Object { - "size": 2081, + "size": 2242, }, "name": "entryB.js", - "size": 2081, + "size": 2242, }, ], "assetsByChunkName": Object { diff --git a/test/__snapshots__/StatsTestCases.test.js.snap b/test/__snapshots__/StatsTestCases.test.js.snap index 4d82bcbe2..10fa5ee09 100644 --- a/test/__snapshots__/StatsTestCases.test.js.snap +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StatsTestCases should print correct stats for aggressive-splitting-entry 1`] = ` -"Hash: d95a12a898a5be2a4cd7d95a12a898a5be2a4cd7 +"Hash: dd0eb370b86c61dc795bdd0eb370b86c61dc795b Child fitting: - Hash: d95a12a898a5be2a4cd7 + Hash: dd0eb370b86c61dc795b Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) Asset Size Chunks Chunk Names 35bda92cf5ea05aff412.js 1.91 KiB {394} [emitted] [immutable] 3e4894c38178f8515f2a.js 1.91 KiB {102} [emitted] [immutable] - ce8a07f513466996e030.js 12.8 KiB {10} [emitted] [immutable] + cae56b30f6d9399ccf70.js 13 KiB {10} [emitted] [immutable] dc9eb8f6a8dc6829a3ce.js 1.08 KiB {785} [emitted] [immutable] - Entrypoint main = 35bda92cf5ea05aff412.js 3e4894c38178f8515f2a.js ce8a07f513466996e030.js - chunk {10} ce8a07f513466996e030.js 1.87 KiB (javascript) 6.41 KiB (runtime) [entry] [rendered] + Entrypoint main = 35bda92cf5ea05aff412.js 3e4894c38178f8515f2a.js cae56b30f6d9399ccf70.js + chunk {10} cae56b30f6d9399ccf70.js 1.87 KiB (javascript) 6.41 KiB (runtime) [entry] [rendered] > ./index main [10] ./index.js 111 bytes {10} [built] [390] ./e.js 899 bytes {10} [built] @@ -31,17 +31,17 @@ Child fitting: > ./g [10] ./index.js 7:0-13 [785] ./g.js 916 bytes {785} [built] Child content-change: - Hash: d95a12a898a5be2a4cd7 + Hash: dd0eb370b86c61dc795b Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) Asset Size Chunks Chunk Names 35bda92cf5ea05aff412.js 1.91 KiB {394} [emitted] [immutable] 3e4894c38178f8515f2a.js 1.91 KiB {102} [emitted] [immutable] - ce8a07f513466996e030.js 12.8 KiB {10} [emitted] [immutable] + cae56b30f6d9399ccf70.js 13 KiB {10} [emitted] [immutable] dc9eb8f6a8dc6829a3ce.js 1.08 KiB {785} [emitted] [immutable] - Entrypoint main = 35bda92cf5ea05aff412.js 3e4894c38178f8515f2a.js ce8a07f513466996e030.js - chunk {10} ce8a07f513466996e030.js 1.87 KiB (javascript) 6.41 KiB (runtime) [entry] [rendered] + Entrypoint main = 35bda92cf5ea05aff412.js 3e4894c38178f8515f2a.js cae56b30f6d9399ccf70.js + chunk {10} cae56b30f6d9399ccf70.js 1.87 KiB (javascript) 6.41 KiB (runtime) [entry] [rendered] > ./index main [10] ./index.js 111 bytes {10} [built] [390] ./e.js 899 bytes {10} [built] @@ -61,7 +61,7 @@ Child content-change: `; exports[`StatsTestCases should print correct stats for aggressive-splitting-on-demand 1`] = ` -"Hash: 7a39663b65f4a5ad06a1 +"Hash: 50408147fbf75054fabd Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) @@ -74,16 +74,16 @@ PublicPath: (none) 7e6da8bd3fac98472dfb.js 1.91 KiB {613} [emitted] [immutable] 80be236ec5df67361c7e.js 1.91 KiB {454} [emitted] [immutable] 8213c4d4d4c1e1378f8b.js 1010 bytes {390} [emitted] [immutable] -b2acabe5914ab27c5854.js 9.32 KiB {179} [emitted] [immutable] main +b4d70738a2da8268595e.js 9.23 KiB {179} [emitted] [immutable] main b5eee76555880be7b1cd.js 1.91 KiB {591} [emitted] [immutable] c4c8bfe99f1a064dc200.js 1.91 KiB {594} [emitted] [immutable] fd5c319770bced17b354.js 1.91 KiB {817} [emitted] [immutable] -Entrypoint main = b2acabe5914ab27c5854.js +Entrypoint main = b4d70738a2da8268595e.js chunk {102} 3e4894c38178f8515f2a.js 1.76 KiB [rendered] [recorded] aggressive splitted > ./c ./d ./e [942] ./index.js 3:0-30 [460] ./c.js 899 bytes {102} {591} [built] [767] ./d.js 899 bytes {102} {817} [built] -chunk {179} b2acabe5914ab27c5854.js (main) 248 bytes (javascript) 4.44 KiB (runtime) [entry] [rendered] +chunk {179} b4d70738a2da8268595e.js (main) 248 bytes (javascript) 4.44 KiB (runtime) [entry] [rendered] > ./index main [942] ./index.js 248 bytes {179} [built] + 4 hidden chunk modules @@ -131,20 +131,20 @@ chunk {847} 6e33027b71300dfeba9c.js 899 bytes [rendered] `; exports[`StatsTestCases should print correct stats for asset 1`] = ` -"Hash: 859bf5dd5e5e6a667776 +"Hash: adda7d944c45c2df4d1f Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 44af8fe384aadccba06e.svg 656 bytes ({179}) [emitted] [immutable] (main) 62787d6ac9d673cc8926.png 14.6 KiB ({179}) [emitted] [immutable] (main) - bundle.js 4.3 KiB {179} [emitted] main + bundle.js 3.7 KiB {179} [emitted] main c2a9ba2e6ec92fd70245.jpg 5.89 KiB ({179}) [emitted] [immutable] (main) Entrypoint main = bundle.js (44af8fe384aadccba06e.svg 62787d6ac9d673cc8926.png c2a9ba2e6ec92fd70245.jpg) [10] ./index.js 111 bytes {179} [built] [359] ./images/file.jpg 5.89 KiB (asset) 42 bytes (javascript) {179} [built] [440] ./images/file.png 14.6 KiB (asset) 42 bytes (javascript) {179} [built] [811] ./images/file.svg 656 bytes (asset) 42 bytes (javascript) {179} [built] - + 4 hidden modules" + + 3 hidden modules" `; exports[`StatsTestCases should print correct stats for async-commons-chunk 1`] = ` @@ -181,10 +181,10 @@ exports[`StatsTestCases should print correct stats for async-commons-chunk-auto > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] + 1 hidden dependent module - chunk {179} disabled/main.js (main) 147 bytes (javascript) 5.07 KiB (runtime) [entry] [rendered] + chunk {179} disabled/main.js (main) 147 bytes (javascript) 4.82 KiB (runtime) [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {334} disabled/async-b.js (async-b) 152 bytes [rendered] > ./b [10] ./index.js 2:0-47 [996] ./b.js 72 bytes {128} {334} [built] @@ -193,15 +193,15 @@ exports[`StatsTestCases should print correct stats for async-commons-chunk-auto > ./c [10] ./index.js 3:0-47 [363] ./c.js + 1 modules 107 bytes {383} {459} [built] + 3 hidden dependent modules - chunk {459} disabled/c.js (c) 167 bytes (javascript) 895 bytes (runtime) [entry] [rendered] + chunk {459} disabled/c.js (c) 167 bytes (javascript) 632 bytes (runtime) [entry] [rendered] > ./c c [363] ./c.js + 1 modules 107 bytes {383} {459} [built] - + 3 hidden root modules + + 2 hidden root modules + 3 hidden dependent modules - chunk {786} disabled/a.js (a) 216 bytes (javascript) 5.02 KiB (runtime) [entry] [rendered] + chunk {786} disabled/a.js (a) 216 bytes (javascript) 4.76 KiB (runtime) [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules + 3 hidden dependent modules chunk {794} disabled/async-a.js (async-a) 216 bytes [rendered] > ./a [10] ./index.js 1:0-47 @@ -220,10 +220,10 @@ Child default: chunk {137} default/async-g.js (async-g) 34 bytes [rendered] > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] - chunk {179} default/main.js (main) 147 bytes (javascript) 5.08 KiB (runtime) [entry] [rendered] + chunk {179} default/main.js (main) 147 bytes (javascript) 4.83 KiB (runtime) [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {282} default/282.js 20 bytes [rendered] split chunk (cache group: defaultVendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -253,10 +253,10 @@ Child default: chunk {769} default/769.js 20 bytes [rendered] split chunk (cache group: defaultVendors) > ./c [10] ./index.js 3:0-47 [769] ./node_modules/z.js 20 bytes {459} {769} [built] - chunk {786} default/a.js (a) 216 bytes (javascript) 5.07 KiB (runtime) [entry] [rendered] + chunk {786} default/a.js (a) 216 bytes (javascript) 4.82 KiB (runtime) [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules + 3 hidden dependent modules chunk {794} default/async-a.js (async-a) 156 bytes [rendered] > ./a [10] ./index.js 1:0-47 @@ -279,10 +279,10 @@ Child vendors: > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] + 1 hidden dependent module - chunk {179} vendors/main.js (main) 147 bytes (javascript) 5.07 KiB (runtime) [entry] [rendered] + chunk {179} vendors/main.js (main) 147 bytes (javascript) 4.81 KiB (runtime) [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {216} vendors/vendors.js (vendors) 60 bytes [initial] [rendered] split chunk (cache group: vendors) (name: vendors) > ./a a > ./b b @@ -303,10 +303,10 @@ Child vendors: [460] ./c.js 72 bytes {383} {459} [built] + 3 hidden root modules + 2 hidden dependent modules - chunk {786} vendors/a.js (a) 176 bytes (javascript) 5.95 KiB (runtime) [entry] [rendered] + chunk {786} vendors/a.js (a) 176 bytes (javascript) 5.7 KiB (runtime) [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules + 1 hidden dependent module chunk {794} vendors/async-a.js (async-a) 216 bytes [rendered] > ./a [10] ./index.js 1:0-47 @@ -333,10 +333,10 @@ Child multiple-vendors: chunk {137} multiple-vendors/async-g.js (async-g) 34 bytes [rendered] > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] - chunk {179} multiple-vendors/main.js (main) 147 bytes (javascript) 5.11 KiB (runtime) [entry] [rendered] + chunk {179} multiple-vendors/main.js (main) 147 bytes (javascript) 4.85 KiB (runtime) [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {334} multiple-vendors/async-b.js (async-b) 72 bytes [rendered] > ./b [10] ./index.js 2:0-47 [996] ./b.js 72 bytes {128} {334} [built] @@ -365,10 +365,10 @@ Child multiple-vendors: > ./c [10] ./index.js 3:0-47 > ./c c [769] ./node_modules/z.js 20 bytes {769} [built] - chunk {786} multiple-vendors/a.js (a) 156 bytes (javascript) 6.01 KiB (runtime) [entry] [rendered] + chunk {786} multiple-vendors/a.js (a) 156 bytes (javascript) 5.75 KiB (runtime) [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {794} multiple-vendors/async-a.js (async-a) 156 bytes [rendered] > ./a [10] ./index.js 1:0-47 [761] ./a.js + 1 modules 156 bytes {786} {794} [built] @@ -391,10 +391,10 @@ Child all: chunk {137} all/async-g.js (async-g) 34 bytes [rendered] > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] - chunk {179} all/main.js (main) 147 bytes (javascript) 5.08 KiB (runtime) [entry] [rendered] + chunk {179} all/main.js (main) 147 bytes (javascript) 4.82 KiB (runtime) [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {282} all/282.js 20 bytes [initial] [rendered] split chunk (cache group: vendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -431,10 +431,10 @@ Child all: > ./c [10] ./index.js 3:0-47 > ./c c [769] ./node_modules/z.js 20 bytes {769} [built] - chunk {786} all/a.js (a) 156 bytes (javascript) 6 KiB (runtime) [entry] [rendered] + chunk {786} all/a.js (a) 156 bytes (javascript) 5.74 KiB (runtime) [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {794} all/async-a.js (async-a) 156 bytes [rendered] > ./a [10] ./index.js 1:0-47 [761] ./a.js + 1 modules 156 bytes {786} {794} [built] @@ -447,13 +447,13 @@ Child all: `; exports[`StatsTestCases should print correct stats for chunk-module-id-range 1`] = ` -"Hash: fffba10b3e71adb5eab8 +"Hash: 2d6915649fa296ee5e68 Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) Asset Size Chunks Chunk Names -main1.js 4.29 KiB {1} [emitted] main1 -main2.js 4.29 KiB {0} [emitted] main2 +main1.js 4.38 KiB {1} [emitted] main1 +main2.js 4.38 KiB {0} [emitted] main2 Entrypoint main1 = main1.js Entrypoint main2 = main2.js chunk {0} main2.js (main2) 136 bytes (javascript) 632 bytes (runtime) [entry] [rendered] @@ -475,7 +475,7 @@ chunk {1} main1.js (main1) 136 bytes (javascript) 632 bytes (runtime) [entry] [r `; exports[`StatsTestCases should print correct stats for chunks 1`] = ` -"Hash: 74e2600626b429de0075 +"Hash: 47793eae3bf579fc3dac Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) @@ -483,7 +483,7 @@ PublicPath: (none) 460.bundle.js 324 bytes {460} [emitted] 524.bundle.js 210 bytes {524} [emitted] 996.bundle.js 142 bytes {996} [emitted] - bundle.js 7.81 KiB {179} [emitted] main + bundle.js 7.75 KiB {179} [emitted] main Entrypoint main = bundle.js chunk {179} bundle.js (main) 73 bytes (javascript) 4.13 KiB (runtime) >{460}< >{996}< [entry] [rendered] > ./index main @@ -515,13 +515,13 @@ chunk {996} 996.bundle.js 22 bytes <{179}> [rendered] `; exports[`StatsTestCases should print correct stats for chunks-development 1`] = ` -"Hash: 9943044533c72884c579 +"Hash: cafb55d2bb1afbf83a4c Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) Asset Size Chunks Chunk Names b_js.bundle.js 359 bytes {b_js} [emitted] - bundle.js 8.41 KiB {main} [emitted] main + bundle.js 8.33 KiB {main} [emitted] main c_js.bundle.js 588 bytes {c_js} [emitted] d_js-e_js.bundle.js 759 bytes {d_js-e_js} [emitted] Entrypoint main = bundle.js @@ -569,42 +569,42 @@ chunk {786} 786.bundle.js (a) 49 bytes <{179}> <{459}> >{459}< [rendered] `; exports[`StatsTestCases should print correct stats for color-disabled 1`] = ` -"Hash: 31a37387c0ddf6ea89ef +"Hash: ab211533610be525b3f8 Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names -main.js 393 bytes {179} [emitted] main + Asset Size Chunks Chunk Names +main.js 54 bytes {179} [emitted] main Entrypoint main = main.js [10] ./index.js 1 bytes {179} [built]" `; exports[`StatsTestCases should print correct stats for color-enabled 1`] = ` -"Hash: 31a37387c0ddf6ea89ef +"Hash: ab211533610be525b3f8 Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names -main.js 393 bytes {179} [emitted] main + Asset Size Chunks Chunk Names +main.js 54 bytes {179} [emitted] main Entrypoint main = main.js [10] ./index.js 1 bytes {179} [built]" `; exports[`StatsTestCases should print correct stats for color-enabled-custom 1`] = ` -"Hash: 31a37387c0ddf6ea89ef +"Hash: ab211533610be525b3f8 Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names -main.js 393 bytes {179} [emitted] main + Asset Size Chunks Chunk Names +main.js 54 bytes {179} [emitted] main Entrypoint main = main.js [10] ./index.js 1 bytes {179} [built]" `; exports[`StatsTestCases should print correct stats for commons-chunk-min-size-0 1`] = ` -"Hash: 8b0f25b609f1b5e23c97 +"Hash: 4aa4b879e151098e9e79 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 429.js 278 bytes {429} [emitted] -entry-1.js 5.22 KiB {472} [emitted] entry-1 +entry-1.js 5.26 KiB {472} [emitted] entry-1 Entrypoint entry-1 = 429.js entry-1.js [115] ./modules/c.js 22 bytes {429} [built] [544] ./modules/f.js 22 bytes {472} [built] @@ -617,11 +617,11 @@ Entrypoint entry-1 = 429.js entry-1.js `; exports[`StatsTestCases should print correct stats for commons-chunk-min-size-Infinity 1`] = ` -"Hash: ba267dae01b031d00d2f +"Hash: 34535b6747a3e0c5488d Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - entry-1.js 5.22 KiB {472} [emitted] entry-1 + entry-1.js 5.26 KiB {472} [emitted] entry-1 vendor-1.js 278 bytes {844} [emitted] vendor-1 Entrypoint entry-1 = vendor-1.js entry-1.js [115] ./modules/c.js 22 bytes {844} [built] @@ -635,29 +635,29 @@ Entrypoint entry-1 = vendor-1.js entry-1.js `; exports[`StatsTestCases should print correct stats for commons-plugin-issue-4980 1`] = ` -"Hash: cf4c537f56fdf7cea7ee30ed073c04d5696027ee +"Hash: 326f4666d7f59ec46ea4d567ed7159b6d51bb2fe Child - Hash: cf4c537f56fdf7cea7ee + Hash: 326f4666d7f59ec46ea4 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - app.0781586acfd984c7eaae.js 6.73 KiB {143} [emitted] [immutable] app + app.55c913e5b0a950747775.js 5.88 KiB {143} [emitted] [immutable] app vendor.4101ce64a32446c20561.js 615 bytes {736} [emitted] [immutable] vendor - Entrypoint app = vendor.4101ce64a32446c20561.js app.0781586acfd984c7eaae.js + Entrypoint app = vendor.4101ce64a32446c20561.js app.55c913e5b0a950747775.js [117] ./entry-1.js + 2 modules 190 bytes {143} [built] [381] ./constants.js 87 bytes {736} [built] - + 4 hidden modules + + 2 hidden modules Child - Hash: 30ed073c04d5696027ee + Hash: d567ed7159b6d51bb2fe Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - app.df6142d05a421de76edc.js 6.75 KiB {143} [emitted] [immutable] app + app.7693f462416a3c7f9218.js 5.9 KiB {143} [emitted] [immutable] app vendor.4101ce64a32446c20561.js 615 bytes {736} [emitted] [immutable] vendor - Entrypoint app = vendor.4101ce64a32446c20561.js app.df6142d05a421de76edc.js + Entrypoint app = vendor.4101ce64a32446c20561.js app.7693f462416a3c7f9218.js [381] ./constants.js 87 bytes {736} [built] [655] ./entry-2.js + 2 modules 197 bytes {143} [built] - + 4 hidden modules" + + 2 hidden modules" `; exports[`StatsTestCases should print correct stats for concat-and-sideeffects 1`] = ` @@ -674,50 +674,49 @@ exports[`StatsTestCases should print correct stats for concat-and-sideeffects 1` ./node_modules/pmodule/bb.js 24 bytes [orphan] [built] ModuleConcatenation bailout: Module is not in any chunk ./node_modules/pmodule/cc.js 24 bytes [orphan] [built] - ModuleConcatenation bailout: Module is not in any chunk - + 2 hidden modules" + ModuleConcatenation bailout: Module is not in any chunk" `; exports[`StatsTestCases should print correct stats for define-plugin 1`] = ` -"Hash: 4e2d37e0d19c44af625ab5911b5fd576c5828cbc3c25efb3ab0c8a2af583 +"Hash: 7cab1d9ee2a096ed005efe9424fb692d4b30471321512c649f7673c12daa Child - Hash: 4e2d37e0d19c44af625a + Hash: 7cab1d9ee2a096ed005e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - main.js 1.27 KiB {179} [emitted] main + main.js 1.36 KiB {179} [emitted] main Entrypoint main = main.js [10] ./index.js 24 bytes {179} [built] Child - Hash: b5911b5fd576c5828cbc + Hash: fe9424fb692d4b304713 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - main.js 1.27 KiB {179} [emitted] main + main.js 1.36 KiB {179} [emitted] main Entrypoint main = main.js [10] ./index.js 24 bytes {179} [built] Child - Hash: 3c25efb3ab0c8a2af583 + Hash: 21512c649f7673c12daa Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - main.js 1.27 KiB {179} [emitted] main + main.js 1.36 KiB {179} [emitted] main Entrypoint main = main.js [10] ./index.js 24 bytes {179} [built]" `; exports[`StatsTestCases should print correct stats for dll-reference-plugin-issue-7624 1`] = ` -"Hash: a759dd3620a361b73561 +"Hash: d3ad4862e7b2aa00eeb8 Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names -bundle.js 424 bytes {179} [emitted] main + Asset Size Chunks Chunk Names +bundle.js 83 bytes {179} [emitted] main Entrypoint main = bundle.js [594] ./entry.js 29 bytes {179} [built]" `; exports[`StatsTestCases should print correct stats for dll-reference-plugin-issue-7624-error 1`] = ` -"Hash: cd1d9858e4acaa298661 +"Hash: 4d3e12077e9df17b5afd Time: Xms Built at: 1970-04-20 12:42:42 1 asset @@ -730,11 +729,11 @@ Unexpected end of JSON input while parsing near '' `; exports[`StatsTestCases should print correct stats for exclude-with-loader 1`] = ` -"Hash: 576f21107f198b5f8cff +"Hash: 77384b6157515f44e15d Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -bundle.js 3.56 KiB {179} [emitted] main +bundle.js 3.48 KiB {179} [emitted] main + 1 hidden asset Entrypoint main = bundle.js (5bcd36918d225eeda398ea3f372b7f16.json) [10] ./index.js 77 bytes {179} [built] @@ -743,26 +742,36 @@ Entrypoint main = bundle.js (5bcd36918d225eeda398ea3f372b7f16.json) `; exports[`StatsTestCases should print correct stats for external 1`] = ` -"Hash: 3204d4c228a794cdf03e +"Hash: e962dc3c940117a2fa2f Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -main.js 1.41 KiB {179} [emitted] main +main.js 1.27 KiB {179} [emitted] main Entrypoint main = main.js [10] ./index.js 17 bytes {179} [built] [697] external \\"test\\" 42 bytes {179} [built]" `; exports[`StatsTestCases should print correct stats for filter-warnings 1`] = ` -"Hash: 13b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac0813b048f6e55de470ac08 +"Hash: 097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e097870b23f08a5bd097e Child undefined: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] + WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction1 [./index.js:8,0] @@ -775,66 +784,66 @@ Child undefined: WARNING in Terser Plugin: Dropping unused function someUnUsedFunction5 [./index.js:12,0] - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] - Child Terser: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js Child /Terser/: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js Child warnings => true: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js Child [Terser]: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js Child [/Terser/]: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js Child [warnings => true]: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js Child should not filter: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] + WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction1 [./index.js:8,0] @@ -847,24 +856,24 @@ Child should not filter: WARNING in Terser Plugin: Dropping unused function someUnUsedFunction5 [./index.js:12,0] - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] - Child /should not filter/: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] + WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction1 [./index.js:8,0] @@ -877,24 +886,24 @@ Child /should not filter/: WARNING in Terser Plugin: Dropping unused function someUnUsedFunction5 [./index.js:12,0] - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] - Child warnings => false: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] + WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction1 [./index.js:8,0] @@ -907,24 +916,24 @@ Child warnings => false: WARNING in Terser Plugin: Dropping unused function someUnUsedFunction5 [./index.js:12,0] - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] - Child [should not filter]: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] + WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction1 [./index.js:8,0] @@ -937,24 +946,24 @@ Child [should not filter]: WARNING in Terser Plugin: Dropping unused function someUnUsedFunction5 [./index.js:12,0] - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] - Child [/should not filter/]: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] + WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction1 [./index.js:8,0] @@ -967,24 +976,24 @@ Child [/should not filter/]: WARNING in Terser Plugin: Dropping unused function someUnUsedFunction5 [./index.js:12,0] - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] - Child [warnings => false]: - Hash: 13b048f6e55de470ac08 + Hash: 097870b23f08a5bd097e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - bundle.js 1.14 KiB {179} [emitted] main + bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] + + WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] + WARNING in Terser Plugin: Dropping side-effect-free statement [./index.js:6,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction1 [./index.js:8,0] @@ -996,16 +1005,6 @@ Child [warnings => false]: WARNING in Terser Plugin: Dropping unused function someUnUsedFunction4 [./index.js:11,0] WARNING in Terser Plugin: Dropping unused function someUnUsedFunction5 [./index.js:12,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction1 [./a.js:3,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction2 [./a.js:4,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction3 [./a.js:5,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction4 [./a.js:6,0] - - WARNING in Terser Plugin: Dropping unused function someRemoteUnUsedFunction5 [./a.js:7,0] " `; @@ -1105,18 +1104,18 @@ chunk {trees} trees.js (trees) 71 bytes [rendered] exports[`StatsTestCases should print correct stats for immutable 1`] = ` " Asset Size Chunks Chunk Names 73f0dbd7f9b6bc12ec24.js 346 bytes {chunk_js} [emitted] [immutable] -d3fa78b8a753e89a00db.js 9.94 KiB {main} [emitted] [immutable] main" +d3fa78b8a753e89a00db.js 9.9 KiB {main} [emitted] [immutable] main" `; exports[`StatsTestCases should print correct stats for import-context-filter 1`] = ` -"Hash: bfc4ff275e7e31190784 +"Hash: 57b8b1606698ce24a5a1 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 398.js 484 bytes {398} [emitted] 544.js 484 bytes {544} [emitted] 718.js 484 bytes {718} [emitted] -entry.js 9.64 KiB {497} [emitted] entry +entry.js 9.62 KiB {497} [emitted] entry Entrypoint entry = entry.js [389] ./templates lazy ^\\\\.\\\\/.*$ include: \\\\.js$ exclude: \\\\.noimport\\\\.js$ namespace object 160 bytes {497} [optional] [built] [398] ./templates/bar.js 38 bytes {398} [optional] [built] @@ -1127,12 +1126,12 @@ Entrypoint entry = entry.js `; exports[`StatsTestCases should print correct stats for import-weak 1`] = ` -"Hash: d6f28492e1a48393c627 +"Hash: a0ccc20f67ca476d9446 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 836.js 142 bytes {836} [emitted] -entry.js 10 KiB {497} [emitted] entry +entry.js 10.3 KiB {497} [emitted] entry Entrypoint entry = entry.js [594] ./entry.js 120 bytes {497} [built] [836] ./modules/b.js 22 bytes {836} [built] @@ -1164,42 +1163,42 @@ Compilation error while processing magic comment(-s): /* webpackPrefetch: nope * `; exports[`StatsTestCases should print correct stats for issue-7577 1`] = ` -"Hash: 88ef17c7849289c157a627029a334751f4122d87f7f42e88584840ed1e2a +"Hash: b53f0804628b50d0576cb2ae19e6edc6426bb795aae25cc1931cdc8ea91c Child - Hash: 88ef17c7849289c157a6 + Hash: b53f0804628b50d0576c Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names a-all-a_js-bc64c4318e0d3dc27f34.js 144 bytes {all-a_js} [emitted] [immutable] a-main-adbd128651f708e1fc04.js 115 bytes {main} [emitted] [immutable] main - a-runtime~main-351c4466c54e4ed428c3.js 4.75 KiB {runtime~main} [emitted] [immutable] runtime~main - Entrypoint main = a-runtime~main-351c4466c54e4ed428c3.js a-all-a_js-bc64c4318e0d3dc27f34.js a-main-adbd128651f708e1fc04.js + a-runtime~main-3396a9fdaf4aca09e9b1.js 4.81 KiB {runtime~main} [emitted] [immutable] runtime~main + Entrypoint main = a-runtime~main-3396a9fdaf4aca09e9b1.js a-all-a_js-bc64c4318e0d3dc27f34.js a-main-adbd128651f708e1fc04.js [./a.js] 18 bytes {all-a_js} [built] + 1 hidden module Child - Hash: 27029a334751f4122d87 + Hash: b2ae19e6edc6426bb795 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - b-all-b_js-2c7830d046ad937beb21.js 506 bytes {all-b_js} [emitted] [immutable] + b-all-b_js-2c7830d046ad937beb21.js 479 bytes {all-b_js} [emitted] [immutable] b-main-754bc63460d9a339fb30.js 148 bytes {main} [emitted] [immutable] main - b-runtime~main-0ccd10401db69cff025e.js 6.2 KiB {runtime~main} [emitted] [immutable] runtime~main + b-runtime~main-5b2a16ba889b8e70119a.js 5.86 KiB {runtime~main} [emitted] [immutable] runtime~main b-vendors-node_modules_vendor_js-7131d1290cb323dbcfab.js 189 bytes {vendors-node_modules_vendor_js} [emitted] [immutable] - Entrypoint main = b-runtime~main-0ccd10401db69cff025e.js b-vendors-node_modules_vendor_js-7131d1290cb323dbcfab.js b-all-b_js-2c7830d046ad937beb21.js b-main-754bc63460d9a339fb30.js + Entrypoint main = b-runtime~main-5b2a16ba889b8e70119a.js b-vendors-node_modules_vendor_js-7131d1290cb323dbcfab.js b-all-b_js-2c7830d046ad937beb21.js b-main-754bc63460d9a339fb30.js [./b.js] 17 bytes {all-b_js} [built] [./node_modules/vendor.js] 23 bytes {vendors-node_modules_vendor_js} [built] - + 4 hidden modules + + 3 hidden modules Child - Hash: f7f42e88584840ed1e2a + Hash: aae25cc1931cdc8ea91c Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names c-all-b_js-2c7830d046ad937beb21.js 506 bytes {all-b_js} [emitted] [immutable] c-all-c_js-a1a7db3683095206a342.js 382 bytes {all-c_js} [emitted] [immutable] c-main-9514bb470390d655c42f.js 164 bytes {main} [emitted] [immutable] main - c-runtime~main-4d4f94a8a7aa437da56e.js 11.2 KiB {runtime~main} [emitted] [immutable] runtime~main + c-runtime~main-fda13d59b35ca08892c9.js 11.4 KiB {runtime~main} [emitted] [immutable] runtime~main c-vendors-node_modules_vendor_js-7131d1290cb323dbcfab.js 189 bytes {vendors-node_modules_vendor_js} [emitted] [immutable] - Entrypoint main = c-runtime~main-4d4f94a8a7aa437da56e.js c-all-c_js-a1a7db3683095206a342.js c-main-9514bb470390d655c42f.js (prefetch: c-vendors-node_modules_vendor_js-7131d1290cb323dbcfab.js c-all-b_js-2c7830d046ad937beb21.js) + Entrypoint main = c-runtime~main-fda13d59b35ca08892c9.js c-all-c_js-a1a7db3683095206a342.js c-main-9514bb470390d655c42f.js (prefetch: c-vendors-node_modules_vendor_js-7131d1290cb323dbcfab.js c-all-b_js-2c7830d046ad937beb21.js) [./b.js] 17 bytes {all-b_js} [built] [./c.js] 61 bytes {all-c_js} [built] [./node_modules/vendor.js] 23 bytes {vendors-node_modules_vendor_js} [built] @@ -1207,13 +1206,13 @@ Child `; exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin 1`] = ` -"Hash: 3c432d5d9526a7bafdcf970d34a94707efffc1094156097412716e90f7546756bb3b299c68c30344 +"Hash: a1be2228badefc93d96f3bec9d24384d1a374ea11738be431f14953a0033b3227d8b8bfd686ebd27 Child 1 chunks: - Hash: 3c432d5d9526a7bafdcf + Hash: a1be2228badefc93d96f Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names - bundle.js 4.28 KiB {179} [emitted] main + Asset Size Chunks Chunk Names + bundle.js 4.2 KiB {179} [emitted] main Entrypoint main = bundle.js chunk {179} bundle.js (main) 219 bytes (javascript) 1.32 KiB (runtime) <{179}> >{179}< [entry] [rendered] [10] ./index.js 101 bytes {179} [built] @@ -1224,12 +1223,12 @@ Child 1 chunks: [996] ./b.js 22 bytes {179} [built] + 3 hidden chunk modules Child 2 chunks: - Hash: 970d34a94707efffc109 + Hash: 3bec9d24384d1a374ea1 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 459.bundle.js 666 bytes {459} [emitted] c - bundle.js 9.85 KiB {179} [emitted] main + bundle.js 9.83 KiB {179} [emitted] main Entrypoint main = bundle.js chunk {179} bundle.js (main) 101 bytes (javascript) 5.45 KiB (runtime) >{459}< [entry] [rendered] [10] ./index.js 101 bytes {179} [built] @@ -1241,13 +1240,13 @@ Child 2 chunks: [847] ./a.js 22 bytes {459} [built] [996] ./b.js 22 bytes {459} [built] Child 3 chunks: - Hash: 4156097412716e90f754 + Hash: 1738be431f14953a0033 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 459.bundle.js 530 bytes {459} [emitted] c 524.bundle.js 210 bytes {524} [emitted] - bundle.js 9.85 KiB {179} [emitted] main + bundle.js 9.83 KiB {179} [emitted] main Entrypoint main = bundle.js chunk {179} bundle.js (main) 101 bytes (javascript) 5.45 KiB (runtime) >{459}< [entry] [rendered] [10] ./index.js 101 bytes {179} [built] @@ -1260,14 +1259,14 @@ Child 3 chunks: [390] ./e.js 22 bytes {524} [built] [767] ./d.js 22 bytes {524} [built] Child 4 chunks: - Hash: 6756bb3b299c68c30344 + Hash: b3227d8b8bfd686ebd27 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 394.bundle.js 210 bytes {394} [emitted] 459.bundle.js 394 bytes {459} [emitted] c 524.bundle.js 210 bytes {524} [emitted] - bundle.js 9.85 KiB {179} [emitted] main + bundle.js 9.83 KiB {179} [emitted] main Entrypoint main = bundle.js chunk {179} bundle.js (main) 101 bytes (javascript) 5.45 KiB (runtime) >{394}< >{459}< [entry] [rendered] [10] ./index.js 101 bytes {179} [built] @@ -1284,11 +1283,11 @@ Child 4 chunks: exports[`StatsTestCases should print correct stats for logging 1`] = ` " [LogTestPlugin] Info -Hash: dc101218c531a5404bd4 +Hash: e7d10acf96bdb3f46c5a Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names -main.js 395 bytes {179} [emitted] main + Asset Size Chunks Chunk Names +main.js 54 bytes {179} [emitted] main Entrypoint main = main.js [390] ./index.js 1 bytes {179} [built] @@ -1325,11 +1324,11 @@ Entrypoint main = main.js `; exports[`StatsTestCases should print correct stats for max-modules 1`] = ` -"Hash: 8bf2783d396dac9e525c +"Hash: 473b769bc2e0caf3e34e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -main.js 5.52 KiB {179} [emitted] main +main.js 5.37 KiB {179} [emitted] main Entrypoint main = main.js [10] ./index.js 181 bytes {179} [built] [92] ./c.js?1 33 bytes {179} [built] @@ -1355,11 +1354,11 @@ Entrypoint main = main.js `; exports[`StatsTestCases should print correct stats for max-modules-default 1`] = ` -"Hash: 8bf2783d396dac9e525c +"Hash: 473b769bc2e0caf3e34e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -main.js 5.52 KiB {179} [emitted] main +main.js 5.37 KiB {179} [emitted] main Entrypoint main = main.js [10] ./index.js 181 bytes {179} [built] [92] ./c.js?1 33 bytes {179} [built] @@ -1380,7 +1379,7 @@ Entrypoint main = main.js `; exports[`StatsTestCases should print correct stats for module-assets 1`] = ` -"Hash: 3102bc113a921add6eca +"Hash: ea1ebe9f02a67e3e53b5 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1388,7 +1387,7 @@ Built at: 1970-04-20 12:42:42 2.png 21 KiB ({128}, {786}) [emitted] (a, b) a.js 988 bytes {786} [emitted] a b.js 616 bytes {128} [emitted] b -main.js 9.12 KiB {179} [emitted] main +main.js 9.1 KiB {179} [emitted] main Entrypoint main = main.js Chunk Group a = a.js (1.png 2.png) Chunk Group b = b.js (2.png) @@ -1467,9 +1466,9 @@ exports[`StatsTestCases should print correct stats for module-deduplication-name async1.js 824 bytes {515} [emitted] async1 async2.js 824 bytes {989} [emitted] async2 async3.js 824 bytes {611} [emitted] async3 - e1.js 10.2 KiB {257} [emitted] e1 - e2.js 10.2 KiB {621} [emitted] e2 - e3.js 10.2 KiB {144} [emitted] e3 + e1.js 10.1 KiB {257} [emitted] e1 + e2.js 10.1 KiB {621} [emitted] e2 + e3.js 10.1 KiB {144} [emitted] e3 Entrypoint e1 = e1.js Entrypoint e2 = e2.js Entrypoint e3 = e3.js @@ -1531,18 +1530,17 @@ If you don't want to include a polyfill, you can use an empty module like this: `; exports[`StatsTestCases should print correct stats for module-reasons 1`] = ` -"Hash: 6d9d722b017768592b1f +"Hash: c755b4565bc79d62d3a6 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -main.js 2.75 KiB {179} [emitted] main +main.js 1.48 KiB {179} [emitted] main Entrypoint main = main.js [237] ./index.js + 2 modules 102 bytes {179} [built] entry ./index main [460] ./c.js 8 bytes {179} [built] cjs require ./c [237] ./index.js + 2 modules ./a.js 1:0-14 - cjs require ./c [237] ./index.js + 2 modules ./b.js 1:0-14 - + 2 hidden modules" + cjs require ./c [237] ./index.js + 2 modules ./b.js 1:0-14" `; exports[`StatsTestCases should print correct stats for module-trace-disabled-in-error 1`] = ` @@ -1653,11 +1651,11 @@ Child `; exports[`StatsTestCases should print correct stats for named-chunks-plugin 1`] = ` -"Hash: b05932e006be87c50021 +"Hash: 517a3876eeb99eef1faa Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - entry.js 5.09 KiB {entry} [emitted] entry + entry.js 5.13 KiB {entry} [emitted] entry vendor.js 241 bytes {vendor} [emitted] vendor Entrypoint entry = vendor.js entry.js [./entry.js] 72 bytes {entry} [built] @@ -1668,11 +1666,11 @@ Entrypoint entry = vendor.js entry.js `; exports[`StatsTestCases should print correct stats for named-chunks-plugin-async 1`] = ` -"Hash: aa9fcd1f744f50618817 +"Hash: eb34ddf74245609b93e4 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names - entry.js 9.72 KiB {entry} [emitted] entry + entry.js 9.7 KiB {entry} [emitted] entry modules_a_js.js 316 bytes {modules_a_js} [emitted] modules_b_js.js 153 bytes {modules_b_js} [emitted] Entrypoint entry = entry.js @@ -1683,7 +1681,7 @@ Entrypoint entry = entry.js `; exports[`StatsTestCases should print correct stats for no-emit-on-errors-plugin-with-child-error 1`] = ` -"Hash: 07b631644fe8988cfb5f +"Hash: 313f55672d7655950e39 Time: Xms Built at: 1970-04-20 12:42:42 2 assets @@ -1706,7 +1704,7 @@ Child child: `; exports[`StatsTestCases should print correct stats for optimize-chunks 1`] = ` -"Hash: 0d6ea4c73bad4061a824 +"Hash: a7e21da2827150d08df2 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1717,7 +1715,7 @@ Built at: 1970-04-20 12:42:42 cir1.js 334 bytes {592} [emitted] cir1 cir2 from cir1.js 378 bytes {288}, {289} [emitted] cir2 from cir1 cir2.js 334 bytes {289} [emitted] cir2 - main.js 8.62 KiB {179} [emitted] main + main.js 8.55 KiB {179} [emitted] main Entrypoint main = main.js chunk {90} ab.js (ab) 2 bytes <{179}> >{753}< [rendered] > [10] ./index.js 1:0-6:8 @@ -1759,7 +1757,6 @@ exports[`StatsTestCases should print correct stats for parse-error 1`] = ` Entrypoint main = main.js [535] ./index.js + 1 modules 35 bytes {179} [built] [996] ./b.js 55 bytes {179} [built] [failed] [1 error] - + 4 hidden modules ERROR in ./b.js 6:7 Module parse failed: Unexpected token (6:7) @@ -1775,9 +1772,9 @@ You may need an appropriate loader to handle this file type, currently no loader `; exports[`StatsTestCases should print correct stats for performance-different-mode-and-target 1`] = ` -"Hash: 1dcfee15de6988b8711a0058b923b8e1b461c4407af3ec752cdd3058f3303da20a6f655890e7e5f00138fe99a0bd9008ebcc3da20a6f655890e7e5f07af3ec752cdd3058f330 +"Hash: 9a4bfc32e1f81c81c7f9110ce87a4d52d2a894c263e4686958307b00d17396fbe24188c24b31e647acda60cd6aaabf975b6396fbe24188c24b31e64763e4686958307b00d173 Child - Hash: 1dcfee15de6988b8711a + Hash: 9a4bfc32e1f81c81c7f9 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1800,7 +1797,7 @@ Child For more info visit https://webpack.js.org/guides/code-splitting/ Child - Hash: 0058b923b8e1b461c440 + Hash: 110ce87a4d52d2a894c2 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1823,7 +1820,7 @@ Child For more info visit https://webpack.js.org/guides/code-splitting/ Child - Hash: 7af3ec752cdd3058f330 + Hash: 63e4686958307b00d173 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1831,7 +1828,7 @@ Child Entrypoint main = no-warning.pro-node.js [10] ./index.js 293 KiB {179} [built] Child - Hash: 3da20a6f655890e7e5f0 + Hash: 96fbe24188c24b31e647 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1839,7 +1836,7 @@ Child Entrypoint main = no-warning.dev-web.js [./index.js] 293 KiB {main} [built] Child - Hash: 0138fe99a0bd9008ebcc + Hash: acda60cd6aaabf975b63 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1847,7 +1844,7 @@ Child Entrypoint main = no-warning.dev-node.js [./index.js] 293 KiB {main} [built] Child - Hash: 3da20a6f655890e7e5f0 + Hash: 96fbe24188c24b31e647 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1855,7 +1852,7 @@ Child Entrypoint main [big] = no-warning.dev-web-with-limit-set.js [./index.js] 293 KiB {main} [built] Child - Hash: 7af3ec752cdd3058f330 + Hash: 63e4686958307b00d173 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names @@ -1932,7 +1929,7 @@ exports[`StatsTestCases should print correct stats for performance-no-async-chun Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names main.js 294 KiB {179} [emitted] [big] main - sec.js 1.59 KiB {295} [emitted] sec + sec.js 1.43 KiB {295} [emitted] sec Entrypoint main [big] = main.js Entrypoint sec = sec.js [10] ./index.js 32 bytes {179} [built] @@ -2013,7 +2010,7 @@ exports[`StatsTestCases should print correct stats for prefetch 1`] = ` " Asset Size Chunks Chunk Names inner.js 114 bytes {746} [emitted] inner inner2.js 154 bytes {641} [emitted] inner2 - main.js 12.2 KiB {179} [emitted] main + main.js 12.4 KiB {179} [emitted] main normal.js 113 bytes {30} [emitted] normal prefetched.js 572 bytes {505} [emitted] prefetched prefetched2.js 114 bytes {379} [emitted] prefetched2 @@ -2070,7 +2067,7 @@ exports[`StatsTestCases should print correct stats for preset-detailed 1`] = ` <+> [LogTestPlugin] Collaped group [LogTestPlugin] Log [LogTestPlugin] End -Hash: 6139fa28764927d9e65a +Hash: f2712c5c8a1edb290ae2 Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) @@ -2078,7 +2075,7 @@ PublicPath: (none) 460.js 324 bytes {460} [emitted] 524.js 210 bytes {524} [emitted] 996.js 142 bytes {996} [emitted] -main.js 7.81 KiB {179} [emitted] main +main.js 7.74 KiB {179} [emitted] main Entrypoint main = main.js chunk {179} main.js (main) 73 bytes (javascript) 4.12 KiB (runtime) >{460}< >{996}< [entry] [rendered] > ./index main @@ -2089,6 +2086,7 @@ chunk {524} 524.js 44 bytes <{460}> [rendered] chunk {996} 996.js 22 bytes <{179}> [rendered] > ./b [10] ./index.js 2:0-16 [10] ./index.js 51 bytes {179} [depth 0] [built] + [no exports used] ModuleConcatenation bailout: Module is not an ECMAScript module [390] ./e.js 22 bytes {524} [depth 2] [built] ModuleConcatenation bailout: Module is not an ECMAScript module @@ -2186,14 +2184,14 @@ exports[`StatsTestCases should print correct stats for preset-normal 1`] = ` " [LogTestPlugin] Error [LogTestPlugin] Warning [LogTestPlugin] Info -Hash: 6139fa28764927d9e65a +Hash: f2712c5c8a1edb290ae2 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 460.js 324 bytes {460} [emitted] 524.js 210 bytes {524} [emitted] 996.js 142 bytes {996} [emitted] -main.js 7.81 KiB {179} [emitted] main +main.js 7.74 KiB {179} [emitted] main Entrypoint main = main.js [10] ./index.js 51 bytes {179} [built] [390] ./e.js 22 bytes {524} [built] @@ -2287,7 +2285,7 @@ exports[`StatsTestCases should print correct stats for preset-verbose 1`] = ` [LogTestPlugin] Inner inner message [LogTestPlugin] Log [LogTestPlugin] End -Hash: 6139fa28764927d9e65a +Hash: f2712c5c8a1edb290ae2 Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) @@ -2295,11 +2293,12 @@ PublicPath: (none) 460.js 324 bytes {460} [emitted] 524.js 210 bytes {524} [emitted] 996.js 142 bytes {996} [emitted] -main.js 7.81 KiB {179} [emitted] main +main.js 7.74 KiB {179} [emitted] main Entrypoint main = main.js chunk {179} main.js (main) 73 bytes (javascript) 4.12 KiB (runtime) >{460}< >{996}< [entry] [rendered] > ./index main [10] ./index.js 51 bytes {179} [depth 0] [built] + [no exports used] ModuleConcatenation bailout: Module is not an ECMAScript module entry ./index main Xms (resolving: Xms, restoring: Xms, integration: Xms, building: Xms, storing: Xms) @@ -2387,11 +2386,11 @@ LOG from webpack.SplitChunksPlugin `; exports[`StatsTestCases should print correct stats for resolve-plugin-context 1`] = ` -"Hash: 10598e1e904b4519125e +"Hash: aede70cc7c8a59cdcd76 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -bundle.js 1.73 KiB {179} [emitted] main +bundle.js 1.58 KiB {179} [emitted] main Entrypoint main = bundle.js [10] ./index.js 48 bytes {179} [built] [258] ./node_modules/def/index.js 16 bytes {179} [built] @@ -2401,11 +2400,11 @@ Entrypoint main = bundle.js `; exports[`StatsTestCases should print correct stats for reverse-sort-modules 1`] = ` -"Hash: 8bf2783d396dac9e525c +"Hash: 473b769bc2e0caf3e34e Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -main.js 5.52 KiB {179} [emitted] main +main.js 5.37 KiB {179} [emitted] main Entrypoint main = main.js [969] ./a.js?3 33 bytes {179} [built] [931] ./c.js?6 33 bytes {179} [built] @@ -2439,8 +2438,8 @@ exports[`StatsTestCases should print correct stats for runtime-chunk-integration "Child base: Asset Size Chunks Chunk Names 505.js 1.22 KiB {505} [emitted] - main1.js 732 bytes {909} [emitted] main1 - runtime.js 9.59 KiB {666} [emitted] runtime + main1.js 556 bytes {909} [emitted] main1 + runtime.js 9.78 KiB {666} [emitted] runtime Entrypoint main1 = runtime.js main1.js [68] ./main1.js 66 bytes {909} [built] [460] ./c.js 20 bytes {505} [built] @@ -2450,8 +2449,8 @@ exports[`StatsTestCases should print correct stats for runtime-chunk-integration Child manifest is named entry: Asset Size Chunks Chunk Names 505.js 1.22 KiB {505} [emitted] - main1.js 732 bytes {909} [emitted] main1 - manifest.js 9.99 KiB {700} [emitted] manifest + main1.js 556 bytes {909} [emitted] main1 + manifest.js 9.91 KiB {700} [emitted] manifest Entrypoint main1 = manifest.js main1.js Entrypoint manifest = manifest.js [68] ./main1.js 66 bytes {909} [built] @@ -2473,7 +2472,7 @@ Entrypoint e2 = runtime.js e2.js" `; exports[`StatsTestCases should print correct stats for scope-hoisting-bailouts 1`] = ` -"Hash: a8c970287be199ebd59b +"Hash: 5c77ad75a4f2b033a86a Time: Xms Built at: 1970-04-20 12:42:42 Entrypoint index = index.js @@ -2499,13 +2498,13 @@ Entrypoint entry = entry.js ModuleConcatenation bailout: Module uses module.id [962] ./concatenated.js + 2 modules 116 bytes {962} [built] ModuleConcatenation bailout: Cannot concat with external \\"external\\" (<- Module is not an ECMAScript module) - + 10 hidden modules" + + 7 hidden modules" `; exports[`StatsTestCases should print correct stats for scope-hoisting-multi 1`] = ` -"Hash: e6923774978a935e0be7aa35977cb5d7b66197f0 +"Hash: 67d50bf596fa0726cee6c7697c00d03ad925f49a Child - Hash: e6923774978a935e0be7 + Hash: 67d50bf596fa0726cee6 Time: Xms Built at: 1970-04-20 12:42:42 Entrypoint first = vendor.js first.js @@ -2523,7 +2522,7 @@ Child [965] ./vendor.js 25 bytes {736} [built] + 10 hidden modules Child - Hash: aa35977cb5d7b66197f0 + Hash: c7697c00d03ad925f49a Time: Xms Built at: 1970-04-20 12:42:42 Entrypoint first = vendor.js first.js @@ -2546,18 +2545,19 @@ Child ModuleConcatenation bailout: Cannot concat with ./common_lazy.js (<- Module is referenced from different chunks by these modules: ./lazy_first.js, ./lazy_second.js) ModuleConcatenation bailout: Cannot concat with ./common_lazy_shared.js (<- Module is referenced from different chunks by these modules: ./lazy_first.js, ./lazy_second.js, ./lazy_shared.js) [965] ./vendor.js 25 bytes {736} [built] - + 13 hidden modules" + + 12 hidden modules" `; exports[`StatsTestCases should print correct stats for side-effects-issue-7428 1`] = ` -"Hash: d16ef3099d8021f66dc9 +"Hash: 665df5f66e538b4f00ac Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names 1.js 642 bytes {1} [emitted] -main.js 10.4 KiB {0} [emitted] main +main.js 10.1 KiB {0} [emitted] main Entrypoint main = main.js [0] ./main.js + 1 modules 231 bytes {0} [built] + [no exports used] harmony side effect evaluation ./CompB ./components/src/CompAB/index.js 2:0-43 harmony export imported specifier ./CompB ./components/src/CompAB/index.js 2:0-43 harmony export imported specifier ./CompAB ./components/src/index.js 1:0-40 (skipped side-effect-free modules) @@ -2566,6 +2566,7 @@ Entrypoint main = main.js | [only some exports used: default] | harmony import specifier ./components ./main.js 4:15-20 (skipped side-effect-free modules) | ./main.js 144 bytes [built] + | [no exports used] [1] ./components/src/CompAB/CompA.js 89 bytes {0} [built] [only some exports used: default] harmony import specifier ./components [0] ./main.js + 1 modules ./main.js 3:15-20 (skipped side-effect-free modules) @@ -2595,17 +2596,18 @@ Entrypoint main = main.js ./components/src/CompC/index.js 34 bytes [orphan] [built] [module unused] harmony side effect evaluation ./CompC ./components/src/index.js 2:0-43 - + 7 hidden modules" + + 6 hidden modules" `; exports[`StatsTestCases should print correct stats for side-effects-simple-unused 1`] = ` -"Hash: 72ef2d94a24261ebb899 +"Hash: 65d4dcd26e77fcf026b7 Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names -main.js 2.67 KiB {179} [emitted] main + Asset Size Chunks Chunk Names +main.js 664 bytes {179} [emitted] main Entrypoint main = main.js [469] ./index.js + 2 modules 158 bytes {179} [built] + [no exports used] harmony side effect evaluation ./c ./node_modules/pmodule/b.js 5:0-24 harmony export imported specifier ./c ./node_modules/pmodule/b.js 5:0-24 entry ./index main @@ -2618,6 +2620,7 @@ Entrypoint main = main.js | harmony import specifier pmodule ./index.js 3:17-18 (skipped side-effect-free modules) | harmony export imported specifier ./b ./node_modules/pmodule/index.js 2:0-30 (skipped side-effect-free modules) | ./index.js 55 bytes [built] + | [no exports used] ./node_modules/pmodule/a.js 60 bytes [orphan] [built] [module unused] harmony side effect evaluation ./a [469] ./index.js + 2 modules ./node_modules/pmodule/index.js 1:0-20 @@ -2626,27 +2629,26 @@ Entrypoint main = main.js [module unused] harmony side effect evaluation ./b [469] ./index.js + 2 modules ./node_modules/pmodule/index.js 2:0-30 harmony export imported specifier ./b [469] ./index.js + 2 modules ./node_modules/pmodule/index.js 2:0-30 - harmony export imported specifier ./b [469] ./index.js + 2 modules ./node_modules/pmodule/index.js 2:0-30 - + 2 hidden modules" + harmony export imported specifier ./b [469] ./index.js + 2 modules ./node_modules/pmodule/index.js 2:0-30" `; exports[`StatsTestCases should print correct stats for simple 1`] = ` -"Hash: 9e3989e8f9e8fa40d52c +"Hash: bed4e69d201237b2ce56 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -bundle.js 629 bytes {main} [emitted] main +bundle.js 270 bytes {main} [emitted] main Entrypoint main = bundle.js [./index.js] 1 bytes {main} [built]" `; exports[`StatsTestCases should print correct stats for simple-more-info 1`] = ` -"Hash: 31a37387c0ddf6ea89ef +"Hash: ab211533610be525b3f8 Time: Xms Built at: 1970-04-20 12:42:42 PublicPath: (none) - Asset Size Chunks Chunk Names -bundle.js 393 bytes {179} [emitted] main + Asset Size Chunks Chunk Names +bundle.js 54 bytes {179} [emitted] main Entrypoint main = bundle.js [10] ./index.js 1 bytes {179} [built] entry ./index main @@ -2667,10 +2669,10 @@ exports[`StatsTestCases should print correct stats for split-chunks 1`] = ` chunk {137} default/async-g.js (async-g) 34 bytes <{282}> <{767}> <{786}> <{794}> <{954}> ={568}= [rendered] > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] - chunk {179} default/main.js (main) 147 bytes (javascript) 5.08 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] + chunk {179} default/main.js (main) 147 bytes (javascript) 4.83 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {282} default/282.js 20 bytes <{179}> ={334}= ={383}= ={568}= ={767}= ={769}= ={794}= ={954}= >{137}< >{568}< [rendered] split chunk (cache group: defaultVendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -2700,10 +2702,10 @@ exports[`StatsTestCases should print correct stats for split-chunks 1`] = ` chunk {769} default/769.js 20 bytes <{179}> ={282}= ={383}= ={568}= ={767}= [rendered] split chunk (cache group: defaultVendors) > ./c [10] ./index.js 3:0-47 [769] ./node_modules/z.js 20 bytes {459} {769} [built] - chunk {786} default/a.js (a) 216 bytes (javascript) 5.07 KiB (runtime) >{137}< >{568}< [entry] [rendered] + chunk {786} default/a.js (a) 216 bytes (javascript) 4.82 KiB (runtime) >{137}< >{568}< [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules + 3 hidden dependent modules chunk {794} default/async-a.js (async-a) 156 bytes <{179}> ={282}= ={767}= ={954}= >{137}< >{568}< [rendered] > ./a [10] ./index.js 1:0-47 @@ -2725,10 +2727,10 @@ Child all-chunks: chunk {137} default/async-g.js (async-g) 34 bytes <{282}> <{767}> <{786}> <{794}> <{954}> ={568}= [rendered] > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] - chunk {179} default/main.js (main) 147 bytes (javascript) 5.08 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] + chunk {179} default/main.js (main) 147 bytes (javascript) 4.83 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {282} default/282.js 20 bytes <{179}> ={128}= ={334}= ={383}= ={459}= ={568}= ={767}= ={769}= ={786}= ={794}= ={954}= >{137}< >{568}< [initial] [rendered] split chunk (cache group: defaultVendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -2765,10 +2767,10 @@ Child all-chunks: > ./c [10] ./index.js 3:0-47 > ./c c [769] ./node_modules/z.js 20 bytes {769} [built] - chunk {786} default/a.js (a) 156 bytes (javascript) 6 KiB (runtime) ={282}= ={767}= ={954}= >{137}< >{568}< [entry] [rendered] + chunk {786} default/a.js (a) 156 bytes (javascript) 5.74 KiB (runtime) ={282}= ={767}= ={954}= >{137}< >{568}< [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {794} default/async-a.js (async-a) 156 bytes <{179}> ={282}= ={767}= ={954}= >{137}< >{568}< [rendered] > ./a [10] ./index.js 1:0-47 [761] ./a.js + 1 modules 156 bytes {786} {794} [built] @@ -2795,10 +2797,10 @@ Child manual: > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] + 1 hidden dependent module - chunk {179} default/main.js (main) 147 bytes (javascript) 5.09 KiB (runtime) >{216}< >{334}< >{383}< >{794}< [entry] [rendered] + chunk {179} default/main.js (main) 147 bytes (javascript) 4.83 KiB (runtime) >{216}< >{334}< >{383}< >{794}< [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {216} default/vendors.js (vendors) 60 bytes <{179}> ={128}= ={334}= ={383}= ={459}= ={786}= ={794}= >{137}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -2834,13 +2836,13 @@ Child manual: [460] ./c.js 72 bytes {383} {459} [built] + 3 hidden root modules + 2 hidden dependent modules - chunk {786} default/a.js (a) 176 bytes (javascript) 6 KiB (runtime) ={216}= >{137}< [entry] [rendered] + chunk {786} default/a.js (a) 176 bytes (javascript) 5.74 KiB (runtime) ={216}= >{137}< [entry] [rendered] > ./a a > x a > y a > z a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules + 1 hidden dependent module chunk {794} default/async-a.js (async-a) 176 bytes <{179}> ={216}= >{137}< [rendered] > ./a [10] ./index.js 1:0-47 @@ -2854,10 +2856,10 @@ Child name-too-long: chunk {137} async-g.js (async-g) 34 bytes <{282}> <{751}> <{767}> <{794}> <{954}> ={568}= [rendered] > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] - chunk {179} main.js (main) 147 bytes (javascript) 5.08 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] + chunk {179} main.js (main) 147 bytes (javascript) 4.82 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {282} 282.js 20 bytes <{179}> ={334}= ={383}= ={568}= ={658}= ={751}= ={766}= ={767}= ={769}= ={794}= ={954}= >{137}< >{568}< [initial] [rendered] split chunk (cache group: defaultVendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -2884,9 +2886,9 @@ Child name-too-long: chunk {658} cccccccccccccccccccccccccccccc.js (cccccccccccccccccccccccccccccc) 2.96 KiB ={282}= ={383}= ={568}= ={767}= ={769}= [entry] [rendered] > ./c cccccccccccccccccccccccccccccc 3 root modules - chunk {751} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) 5.99 KiB ={282}= ={767}= ={794}= ={954}= >{137}< >{568}< [entry] [rendered] + chunk {751} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) 5.73 KiB ={282}= ={767}= ={794}= ={954}= >{137}< >{568}< [entry] [rendered] > ./a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - 7 root modules + 6 root modules chunk {766} bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) 2.96 KiB ={282}= ={334}= ={568}= ={767}= ={954}= [entry] [rendered] > ./b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 root modules @@ -2925,10 +2927,10 @@ Child custom-chunks-filter: chunk {137} default/async-g.js (async-g) 34 bytes <{282}> <{767}> <{786}> <{794}> <{954}> ={568}= [rendered] > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] - chunk {179} default/main.js (main) 147 bytes (javascript) 5.08 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] + chunk {179} default/main.js (main) 147 bytes (javascript) 4.83 KiB (runtime) >{282}< >{334}< >{383}< >{568}< >{767}< >{769}< >{794}< >{954}< [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {282} default/282.js 20 bytes <{179}> ={128}= ={334}= ={383}= ={459}= ={568}= ={767}= ={769}= ={794}= ={954}= >{137}< >{568}< [initial] [rendered] split chunk (cache group: defaultVendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -2963,10 +2965,10 @@ Child custom-chunks-filter: > ./c [10] ./index.js 3:0-47 > ./c c [769] ./node_modules/z.js 20 bytes {769} [built] - chunk {786} default/a.js (a) 216 bytes (javascript) 5.07 KiB (runtime) >{137}< >{568}< [entry] [rendered] + chunk {786} default/a.js (a) 216 bytes (javascript) 4.82 KiB (runtime) >{137}< >{568}< [entry] [rendered] > ./a a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] - + 7 hidden root modules + + 6 hidden root modules + 3 hidden dependent modules chunk {794} default/async-a.js (async-a) 156 bytes <{179}> ={282}= ={767}= ={954}= >{137}< >{568}< [rendered] > ./a [10] ./index.js 1:0-47 @@ -2993,10 +2995,10 @@ Child custom-chunks-filter-in-cache-groups: > ./g ./a.js 6:0-47 [785] ./g.js 34 bytes {137} [built] + 1 hidden dependent module - chunk {179} default/main.js (main) 147 bytes (javascript) 5.09 KiB (runtime) >{216}< >{334}< >{383}< >{794}< [entry] [rendered] + chunk {179} default/main.js (main) 147 bytes (javascript) 4.83 KiB (runtime) >{216}< >{334}< >{383}< >{794}< [entry] [rendered] > ./ main [10] ./index.js 147 bytes {179} [built] - + 7 hidden root modules + + 6 hidden root modules chunk {216} default/vendors.js (vendors) 60 bytes <{179}> ={128}= ={334}= ={383}= ={459}= ={794}= >{137}< [initial] [rendered] split chunk (cache group: vendors) (name: vendors) > ./a [10] ./index.js 1:0-47 > ./b [10] ./index.js 2:0-47 @@ -3028,14 +3030,14 @@ Child custom-chunks-filter-in-cache-groups: [460] ./c.js 72 bytes {383} {459} [built] + 3 hidden root modules + 2 hidden dependent modules - chunk {786} default/a.js (a) 236 bytes (javascript) 5.03 KiB (runtime) >{137}< [entry] [rendered] + chunk {786} default/a.js (a) 236 bytes (javascript) 4.77 KiB (runtime) >{137}< [entry] [rendered] > ./a a > x a > y a > z a [761] ./a.js + 1 modules 156 bytes {786} {794} [built] [769] ./node_modules/z.js 20 bytes {216} {786} [built] - + 7 hidden root modules + + 6 hidden root modules + 3 hidden dependent modules chunk {794} default/async-a.js (async-a) 176 bytes <{179}> ={216}= >{137}< [rendered] > ./a [10] ./index.js 1:0-47 @@ -3075,10 +3077,10 @@ chunk {common-node_modules_y_js} common-node_modules_y_js.js 20 bytes <{main}> = chunk {common-node_modules_z_js} common-node_modules_z_js.js 20 bytes <{main}> ={async-c}= ={common-d_js}= ={common-f_js}= ={common-node_modules_x_js}= [rendered] split chunk (cache group: b) > ./c [10] ./index.js 3:0-47 [769] ./node_modules/z.js 20 bytes {common-node_modules_z_js} [built] -chunk {main} main.js (main) 147 bytes (javascript) 5 KiB (runtime) >{async-a}< >{async-b}< >{async-c}< >{common-d_js}< >{common-f_js}< >{common-node_modules_x_js}< >{common-node_modules_y_js}< >{common-node_modules_z_js}< [entry] [rendered] +chunk {main} main.js (main) 147 bytes (javascript) 4.74 KiB (runtime) >{async-a}< >{async-b}< >{async-c}< >{common-d_js}< >{common-f_js}< >{common-node_modules_x_js}< >{common-node_modules_y_js}< >{common-node_modules_z_js}< [entry] [rendered] > ./ main [10] ./index.js 147 bytes {main} [built] - + 7 hidden root modules" + + 6 hidden root modules" `; exports[`StatsTestCases should print correct stats for split-chunks-combinations 1`] = ` @@ -3181,10 +3183,10 @@ chunk {282} 282.js 20 bytes <{128}> ={459}= ={786}= [initial] [rendered] split c chunk {459} c.js (c) 12 bytes <{128}> ={282}= [rendered] > ./c [996] ./b.js 1:0-41 [460] ./c.js 12 bytes {459} [built] -chunk {786} a.js (a) 12 bytes (javascript) 2.59 KiB (runtime) ={282}= [entry] [rendered] +chunk {786} a.js (a) 12 bytes (javascript) 2.33 KiB (runtime) ={282}= [entry] [rendered] > ./a a [847] ./a.js 12 bytes {786} [built] - + 2 hidden root modules" + + 1 hidden root module" `; exports[`StatsTestCases should print correct stats for split-chunks-keep-remaining-size 1`] = ` @@ -3275,10 +3277,10 @@ exports[`StatsTestCases should print correct stats for split-chunks-max-size 1`] > ./ main [2] ./big.js?2 268 bytes {662} [built] [838] ./big.js?1 268 bytes {662} [built] - chunk {663} prod-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.24 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered] + chunk {663} prod-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 2.97 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered] > ./ main [463] ./very-big.js?1 1.57 KiB {663} [built] - + 4 hidden root modules + + 3 hidden root modules chunk {869} prod-869.js 402 bytes ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={663}= [initial] [rendered] split chunk (cache group: defaultVendors) > ./ main [302] ./node_modules/small.js?1 67 bytes {869} [built] @@ -3396,10 +3398,10 @@ Child switched: [853] ./subfolder/small.js?2 67 bytes {581} [built] [943] ./subfolder/small.js?3 67 bytes {581} [built] + 5 hidden root modules - chunk {663} switched-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.22 KiB (runtime) ={1}= ={59}= ={247}= ={318}= ={520}= ={581}= ={997}= [entry] [rendered] + chunk {663} switched-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 2.95 KiB (runtime) ={1}= ={59}= ={247}= ={318}= ={520}= ={581}= ={997}= [entry] [rendered] > ./ main [463] ./very-big.js?1 1.57 KiB {663} [built] - + 4 hidden root modules + + 3 hidden root modules chunk {997} switched-main-7aeafcb2.js (main-7aeafcb2) 1.64 KiB ={1}= ={59}= ={247}= ={318}= ={520}= ={581}= ={663}= [initial] [rendered] > ./ main [2] ./big.js?2 268 bytes {997} [built] @@ -3494,10 +3496,10 @@ Child zero-min: > ./ main [2] ./big.js?2 268 bytes {662} [built] [838] ./big.js?1 268 bytes {662} [built] - chunk {663} zero-min-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 3.24 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered] + chunk {663} zero-min-main-12217e1d.js (main-12217e1d) 1.57 KiB (javascript) 2.97 KiB (runtime) ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={869}= [entry] [rendered] > ./ main [463] ./very-big.js?1 1.57 KiB {663} [built] - + 4 hidden root modules + + 3 hidden root modules chunk {869} zero-min-869.js 402 bytes ={1}= ={59}= ={198}= ={204}= ={318}= ={358}= ={400}= ={410}= ={490}= ={520}= ={662}= ={663}= [initial] [rendered] split chunk (cache group: defaultVendors) > ./ main [302] ./node_modules/small.js?1 67 bytes {869} [built] @@ -3533,9 +3535,9 @@ Child enforce-min-size: chunk {10} enforce-min-size-10.js 1.19 KiB ={179}= ={221}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [initial] [rendered] split chunk (cache group: all) > ./ main [10] ./index.js 1.19 KiB {10} [built] - chunk {179} enforce-min-size-main.js (main) 3.25 KiB ={10}= ={221}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [entry] [rendered] + chunk {179} enforce-min-size-main.js (main) 2.98 KiB ={10}= ={221}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [entry] [rendered] > ./ main - 4 root modules + 3 root modules chunk {221} enforce-min-size-221.js 1.57 KiB ={10}= ={179}= ={262}= ={410}= ={434}= ={463}= ={519}= ={575}= ={614}= ={692}= ={822}= ={825}= ={869}= [initial] [rendered] split chunk (cache group: all) > ./ main [221] ./very-big.js?3 1.57 KiB {221} [built] @@ -3631,14 +3633,15 @@ chunk {794} default/async-a.js (async-a) 134 bytes <{179}> [rendered] `; exports[`StatsTestCases should print correct stats for tree-shaking 1`] = ` -"Hash: 0670893304ca17d79f70 +"Hash: c9c4c371e4f55d22ac03 Time: Xms Built at: 1970-04-20 12:42:42 - Asset Size Chunks Chunk Names -bundle.js 7.79 KiB {179} [emitted] main + Asset Size Chunks Chunk Names +bundle.js 7.2 KiB {179} [emitted] main Entrypoint main = bundle.js [10] ./index.js 315 bytes {179} [built] [no exports] + [no exports used] [405] ./require.include.js 36 bytes {179} [built] [exports: a, default] [no exports used] @@ -3665,17 +3668,18 @@ Entrypoint main = bundle.js [996] ./b.js 13 bytes {179} [built] [exports: b] [no exports used] - + 3 hidden modules" + + 2 hidden modules" `; exports[`StatsTestCases should print correct stats for warnings-terser 1`] = ` -"Hash: 585c2063c7354fc75bb6 +"Hash: 44017efba0d77742d0ea Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names -bundle.js 1.14 KiB {179} [emitted] main +bundle.js 1.12 KiB {179} [emitted] main Entrypoint main = bundle.js [10] ./index.js 299 bytes {179} [built] + [no exports used] [847] ./a.js 249 bytes {179} [built] + 1 hidden module @@ -3692,7 +3696,7 @@ WARNING in Terser Plugin: Dropping unused function someUnRemoteUsedFunction5 [./ `; exports[`StatsTestCases should print correct stats for wasm-explorer-examples-sync 1`] = ` -"Hash: 6c38accf2bcfaddb4833 +"Hash: bf1592a84ce479fa69d6 Time: Xms Built at: 1970-04-20 12:42:42 Asset Size Chunks Chunk Names diff --git a/test/configCases/code-generation/use-strict/index.js b/test/configCases/code-generation/use-strict/index.js index edcf0d4f6..5388a8fc0 100644 --- a/test/configCases/code-generation/use-strict/index.js +++ b/test/configCases/code-generation/use-strict/index.js @@ -18,14 +18,9 @@ it("should include only one use strict per module", function() { matches.sort(); expect(matches).toEqual([ - '/* unused harmony default export */ var _unused_webpack_default_export = ("a");', "/******/ // Check if module is in cache", "/******/ // define __esModule on exports", "/******/ // define getter functions for harmony exports", - "__webpack_require__.r(__webpack_exports__);", - "__webpack_require__.r(__webpack_exports__);", - "__webpack_require__.r(__webpack_exports__);", - "__webpack_require__.r(__webpack_exports__);", - 'it("should include only one use strict per module", function() {' + "/******/ var __webpack_modules__ = ({" ]); }); diff --git a/test/configCases/errors/self-reexport/errors.js b/test/configCases/errors/self-reexport/errors.js index 3d8a2be43..c121b1289 100644 --- a/test/configCases/errors/self-reexport/errors.js +++ b/test/configCases/errors/self-reexport/errors.js @@ -1,5 +1,5 @@ module.exports = [ + [/Circular reexports "\.\/c2.js"\.something --> "\.\/c1.js"\.something -\(circular\)-> "\.\/c2.js"\.something/], [/Circular reexports "\.\/a.js"\.something -\(circular\)-> "\.\/a.js"\.something/], [/Circular reexports "\.\/b.js"\.other --> "\.\/b.js"\.something -\(circular\)-> "\.\/b.js"\.other/], - [/Circular reexports "\.\/c2.js"\.something --> "\.\/c1.js"\.something -\(circular\)-> "\.\/c2.js"\.something/] ];