Skip to content

Commit 205d446

Browse files
docs: tighten the annotation comments
Review feedback: keep both to the two short lines the guide asks for, without losing the minifier binding rule a new call site has to know. Refs #17121
1 parent 2386a33 commit 205d446

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎lib/template/RuntimeTemplate.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,10 +1861,8 @@ class RuntimeTemplate {
18611861
}
18621862

18631863
/**
1864-
* The annotation for a module instantiation, carrying what webpack knows about
1865-
* the module's side effects on to whoever consumes the emitted bundle. Only ever
1866-
* write it in front of a call the emitted statement itself terminates: a minifier
1867-
* binds it to the outermost call, so `f(id)(x)` would drop `(x)` along with it.
1864+
* A module instantiation's side-effect annotation. Write it only where the
1865+
* statement ends the call: a minifier reads `f(id)(x)` as one and drops it.
18681866
* @param {Module} module the instantiated module
18691867
* @param {ModuleGraph} moduleGraph the module graph
18701868
* @returns {string} the annotation, or an empty string when it may have side effects

‎types.d.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26887,10 +26887,8 @@ declare abstract class RuntimeTemplate {
2688726887
}): string;
2688826888

2688926889
/**
26890-
* The annotation for a module instantiation, carrying what webpack knows about
26891-
* the module's side effects on to whoever consumes the emitted bundle. Only ever
26892-
* write it in front of a call the emitted statement itself terminates: a minifier
26893-
* binds it to the outermost call, so `f(id)(x)` would drop `(x)` along with it.
26890+
* A module instantiation's side-effect annotation. Write it only where the
26891+
* statement ends the call: a minifier reads `f(id)(x)` as one and drops it.
2689426892
*/
2689526893
moduleSideEffectsAnnotation(module: Module, moduleGraph: ModuleGraph): string;
2689626894

0 commit comments

Comments
 (0)