Comparison
MinificationvsResponse compression
Minification
the shipped file is one line, every local variable is a single letter, and the comments are gone.
Rewriting code to be smaller while preserving behaviour: shorter names, no whitespace, collapsed expressions. It typically halves the raw size, though compression on the wire means the marginal gain over gzip is smaller than the raw numbers suggest. It also makes production stack traces unreadable, which is what source maps exist to undo.
Full entry →Response compression
the bundle is 800 kilobytes on disk and 190 over the wire, which is the number that matters.
Encoding text responses with gzip or brotli so the transferred size is a fraction of the raw size. Brotli typically beats gzip by a further fifteen to twenty percent on JavaScript and CSS. It is the reason raw bundle sizes are misleading in both directions: minification gains partly overlap with what compression would have done anyway, and an image or font gains nothing because it is already compressed.
Full entry →