LearnThatStack Ace your next interview
Vite & Webpack · question
Question 15 of 89

What is the difference between transpilation, minification, and compression?

beginner
← All Vite & Webpack questions
Re-explain
Visual ↓

Transpilation changes the syntax, minification makes the code smaller without changing what it does, and compression encodes the bytes sent over the network.

Transpilation Minification Compression
What changes The syntax, such as TypeScript or newer JavaScript turned into JavaScript older browsers run Whitespace and comments removed, long names shortened, dead code dropped The bytes, encoded with gzip or Brotli
Typical tool Babel, TypeScript, Oxc Terser, Oxc minifier The web server or a content delivery network (CDN)
When it runs Build time, file by file Build time, after bundling When the file is served, and the browser decodes it

Transpilation is about compatibility, such as erasing TypeScript types or rewriting modern syntax for older browsers. Minification is about size, and most of its savings come from removing whitespace and shortening names, called mangling. Compression comes last. The server sends the minified file gzip or Brotli encoded, and the browser decodes it to the same text. Some builds also write pre-compressed .gz or .br files so the server does not compress on every request.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
See it - interactive diagram
One snippet through transpile, minify and compress
(price: number) => price * 2
stage 1Build: transpileBabel or TypeScript removes the types, one file at a time.
(price) => price * 2
stage 2Build: minifyAfter bundling, Terser removes spaces and renames price to e.
e=>e*2
stage 3Serve: compressThe server or CDN encodes the bytes with gzip or Brotli.
1f 8b 08 00 ... gzip bytes
stage 4Browser: decodeThe browser decodes it to the exact same minified text.
e=>e*2

Transpiling and minifying change the code at build time, and those changes stay. The browser undoes compression and gets the same minified text.

© LearnThatStack - diagrams may not be republished without permission.

Other questions have diagrams like this too. Sign in to ask for one where it's missing - it's free.

Create a free account
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the Vite & Webpack cheatsheet.

← Back to all Vite & Webpack questions
Pro · $10/mo

74 of 89 Vite & Webpack answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime