Skip to content

Commit f164686

Browse files
perf(compilation): release the code generation jobs when nothing taps the hook
`_runCodeGenerationJobs` captured the full jobs array so embedded source could be resolved over all of it, which kept it alive through every delayed iteration that `jobs = delayedJobs` would otherwise free. Untapped nothing is ever recorded, so the capture is skipped and an untapped build retains exactly what it did before. Also drops an orphaned copy of `_renderDataUrl`'s JSDoc that had been left sitting above `_CSS_STRING_ESCAPE_RE`.
1 parent d57c21c commit f164686

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

‎lib/Compilation.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4191,7 +4191,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
41914191
return callback();
41924192
}
41934193
// `jobs` is reassigned per iteration; embedded source is resolved over all.
4194-
const allJobs = jobs;
4194+
// Untapped nothing is recorded, so the array is not held past its iteration.
4195+
const allJobs =
4196+
this.hooks.renderEmbeddedSource.taps.length === 0 ? undefined : jobs;
41954197
let statModulesFromCache = 0;
41964198
let statModulesGenerated = 0;
41974199
const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } =
@@ -4284,7 +4286,7 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
42844286
(statModulesGenerated + statModulesFromCache)
42854287
)}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)`
42864288
);
4287-
this._resolveEmbeddedSources(allJobs, (err) => {
4289+
this._resolveEmbeddedSources(allJobs || jobs, (err) => {
42884290
this._embeddedSources.clear();
42894291
this._pendingEmbeddedSources.clear();
42904292
callback(err);

‎lib/css/syntax.js‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11965,14 +11965,6 @@ let _unitScale = ABSOLUTE_UNIT_SCALE;
1196511965
/** @type {EmbeddedSourceRenderer | undefined} */
1196611966
let _renderEmbeddedSource;
1196711967

11968-
/**
11969-
* Offer a url's `data:` payload to the renderer, and rebuild the URL around
11970-
* what comes back. `null` when nothing should change — not a data URL, a media
11971-
* type naming no language webpack knows, a payload that would not round-trip,
11972-
* or a renderer that declined.
11973-
* @param {string} url the url body, unquoted and unescaped
11974-
* @returns {string | null} the rebuilt URL, or null to emit the original
11975-
*/
1197611968
const _CSS_STRING_ESCAPE_RE = /[\\\n]/g;
1197711969

1197811970
/**

0 commit comments

Comments
 (0)