logo
By Lawrence

5 minutes

Ship It

The game runs on your machine, with the debug panels inside it. Players should get the game and not the debugger.

Code that can never run

A production build leaves out code that can never run. In a build, Vite turns import.meta.env.DEV into the constant false, so the bundler sees this:

if (false) {
  // … every import in here, and everything only they bring in
}

The block is dead, and it goes, imports and all. On the finished game the panels are 87,129 bytes of the main script, 27,063 gzipped, plus a 17,538-byte stylesheet: 1.7% of the script, 2.3% gzipped.

Continue reading

Unlock the Full Course

Every lesson, the runnable examples, and the finished build — yours to keep.

$9one-time

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search