A 45-Second Build to Change a Button Color
A small CSS change took 45 seconds to verify in a TypeScript and Vite build. Some notes on where the time went and what might help.
· 2 min read · Erik Kubica
Yesterday afternoon, I needed to change a secondary button's border color from #cbd5e1 to #94a3b8 on an internal admin portal.
In 2013, that edit took a few seconds: open style.css, update the hexadecimal value, save, and refresh the browser.
This time it went differently.
I edited the token in a nested component file and saved. The hot-module-replacement server picked it up and my CPU fans spun up. Then I ran the production build to confirm nothing broke in the static output:
$ time npm run build
> admin-dashboard@2.4.0 build
> tsc --noEmit && vite build
vite v5.2.11 building for production...
transforming (1420) node_modules/...
✓ 2840 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html 1.42 kB │ gzip: 0.68 kB
dist/assets/index-D7x81B1z.css 48.12 kB │ gzip: 9.14 kB
dist/assets/index-BKz89L2q.js 412.80 kB │ gzip: 124.50 kB
✓ built in 42.84s
real 0m45.120s
user 1m18.420s
sys 0m8.940s
Forty-five seconds of clock time, and a bit over a minute of CPU time across eight cores, for a one-line CSS change.
Where the Time Goes
Modern frontend builds are a chain of steps, each of which exists for a reason:
tscparses types and checks them across your code and the declaration files innode_modules.- A bundler (
esbuild,rollup, orturbopack) walks the import graph. - PostCSS parses utility classes, runs autoprefixer, and minifies stylesheets.
- Tree-shaking discards code from imported libraries that is never used.
- A content-hash step generates filenames for cache busting.
- Source map generation produces debugging files.
Your tsconfig.json ends up carrying settings for several of those tools at once:
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true,
"incremental": true,
"isolatedModules": true
}
}
"skipLibCheck": true is a good example. Many teams turn it on because checking every type definition the dependencies ship noticeably slows the build.
A Compiled Backend for Comparison
For comparison, here is a Go build on a backend project:
$ time go build -o server ./cmd/api
real 0m0.742s
user 0m1.840s
sys 0m0.280s
About 0.7 seconds. This is not a fair comparison, since a Go service and a bundled frontend do different jobs, but it shows how quick a feedback loop can be.
In practice a lot of this is fixable without dropping the tools. Running tsc only in CI or a pre-push hook, keeping the dev server for day-to-day edits, and relying on incremental builds all cut the wait. I like static types, and TypeScript has caught plenty of null bugs in my code over the years, so I would keep it. The part worth watching is whether the build time is slowly eating into the feedback loop, and in my case it was worth taking a look.