FE7: The modern frontend toolkit

Lesson 1 of 5 ยท reading 15โ€“25 minutes; practice and project time is on the module page

What build tools do

๐ŸŽฏYou'll be able to

Explain what a build tool does with your code and read its output.

๐Ÿ The everyday picture

A printing press takes a writer's manuscript, sets the type, arranges the pages and binds them into a book readers can use. A build tool takes the code you write and turns it into files browsers can load quickly.

๐Ÿ“˜What it really is

๐Ÿ“A worked example

Kirana Express's admin tool was on an old Webpack set-up:

Measure Old Webpack config After moving to Vite
Dev server start 48 s 1.5 s
Change to visible update 4โ€“6 s Under 0.5 s
Config file 310 lines, written by someone who left 25 lines
Production bundle Similar size Similar size

The team checked the production build with npm run preview and a full click-through before switching.

๐ŸŒWhere it's used

๐Ÿ“Case scenario

An app works perfectly with npm run dev, but the deployed version shows a blank page. The browser console says a file isn't found: the production build expects to be served from the site root, but it's deployed under /admin/. Setting the build's base path to /admin/ and testing with npm run preview fixes it.

๐Ÿ–ฑ๏ธTry it

Create a new Vite + React + TypeScript project. Time the dev server start and a change appearing, then run npm run build, look at the files in dist/, and serve them with npm run preview.

โš ๏ธCommon mistakes

๐Ÿ› ๏ธFor your project

The starter kit builds with Next.js (npm run build); its output lists each page's JavaScript size, which you'll compare in Project 3.

โœ…Quick check

What is hot module replacement?

Show the answer

Updating changed code in the running page instantly, without a full reload or losing state.

Why test the production build before releasing?

Show the answer

Some bugs appear only after production transforms and paths, not in the development server.

โ† BackFE7
ProLearners Assist