You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: keep export mangling for modules whose namespace object escapes
When a module's namespace object is used as a whole value (for example
re-exported and returned, spread, or passed around) export mangling was
disabled for the whole module, bloating every reference in all other
consumers.
Such modules now keep their exports mangleable: the escaping reference is
rendered as a decoupled namespace object that exposes the original export
names via getters onto the mangled bindings, so access by the original name
keeps working. Driven by optimization.mangleExports, for both
non-concatenated and concatenated builds. Left conservative (unchanged) for
CommonJS interop, dynamic imports and deferred imports.
To preserve ES module namespace semantics on the escaping module, its
exports stay non-inlinable and member access keeps a qualified property
access: a missing export reads as `ns.x` (not a bare `undefined`) and
`delete ns.x` hits a real non-configurable binding, so it stays valid and
throws where the spec requires.
Closes#19153.
* docs: prefer Closes/Fixes over Refs when a PR resolves the issue
Clarify the PR-body guidance to use the auto-closing `Closes #…`/`Fixes #…`
form when the PR actually fixes the bug or implements the requested feature,
reserving `Refs #…` for issues a PR only relates to.
Keep export mangling enabled for modules whose namespace object is used as a whole value, by materializing a decoupled namespace object that keeps the original export names.
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,7 +267,7 @@ Make sure to read our AI policy (https://github.com/webpack/governance/blob/main
267
267
268
268
Required answer per section — **one sentence each is the target, two or three the absolute maximum**:
269
269
270
-
-**Summary** — motivation and what problem is solved; link the related issue (`Closes #…` / `Fixes #…`).
270
+
-**Summary** — motivation and what problem is solved; link the related issue. When the PR actually fixes the bug or implements the feature the issue asks for, use the auto-closing form `Closes #…` / `Fixes #…` (not `Refs #…`); reserve `Refs #…` for issues the PR only relates to but does not resolve.
271
271
-**What kind of change does this PR introduce?** — one of: fix, feat, refactor, perf, test, chore, ci, build, style, revert, docs.
272
272
-**Did you add tests for your changes?** — yes/no + which test files.
273
273
-**Does this PR introduce a breaking change?** — yes/no + migration path if yes.
* Encodes how a concatenated module reference should be interpreted when it is
@@ -27,6 +27,7 @@ const MODULE_REFERENCE_REGEXP =
27
27
* @property {boolean} call true, when this referenced export is called
28
28
* @property {boolean} directImport true, when this referenced export is directly imported (not via property access)
29
29
* @property {boolean} deferredImport true, when this referenced export is deferred
30
+
* @property {boolean} mangleableNamespace true, when a whole-namespace reference may use a decoupled namespace object that keeps the original export names
30
31
* @property {boolean | undefined} asiSafe if the position is ASI safe or unknown
* @param {boolean=} options.mangleableNamespace true, when a whole-namespace value may use a decoupled namespace object that keeps the original export names
0 commit comments