Skip to content

Commit 7ee8afc

Browse files
feat(javascript): drop unused reads and calls of built-ins in the minifier
The `improve` phase drops an expression nobody reads that only reads a built-in global or its own or prototype property, calls or constructs one on literal arguments without throwing at build time, or reads a global a `typeof` before it proved declared. `tooling/generate-js-data.js` lists the built-ins from @mdn/browser-compat-data, each in every Node webpack builds on, less those that run code, reject promises, block agents or read the locale. Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
1 parent 0064fd9 commit 7ee8afc

8 files changed

Lines changed: 1129 additions & 822 deletions

File tree

‎.changeset/047-javascript-minifier-unwrap-iife.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"webpack": patch
33
---
44

5-
Run statement IIFEs in place and fold built-in calls on literals when minifying JS.
5+
Unwrap IIFEs, fold built-in calls and drop unused built-ins when minifying JS.

‎docs/syntax.md‎

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

‎lib/javascript/syntax-printer-data.js‎

Lines changed: 263 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)