Capstone — Configuring a Real Project's Build Pipeline
A small dashboard app, built with Vite: a main page, a lazy-loaded settings panel, CSS Modules for styling, and an environment-driven API URL — combining every chapter this course has covered into one real, working configuration.
Project Layout
Environment Variables
Vite only exposes environment variables prefixed with VITE_ to client-side code — a deliberate, security-conscious default that prevents accidentally leaking server-only secrets into a bundle shipped to every user's browser.
vite.config.js
postcss.config.js
src/Dashboard.module.css
src/main.js — Everything Combined
package.json Scripts
Chapter Attribution
| Capstone piece | Concept | From |
|---|---|---|
| The entire premise — why any of this config exists | Real apps outgrow <script src>, npm packages need translation | build-tooling1-1 |
| import/export throughout, main.js as the entry point | The dependency graph and entry-point model | build-tooling1-2 |
| Choosing Vite instead of a webpack.config.js | The exact trade-off Webpack's own complexity sets up | build-tooling1-3 |
| No explicit transpilation config needed | Vite's internal esbuild-based transpilation absorbs this job automatically | build-tooling1-4 |
| vite.config.js, npm run dev / npm run build | Native-ESM dev server vs. Rollup-powered production build | build-tooling1-5 |
| Why dev startup and rebuilds feel instant | esbuild's own AOT-compiled, natively parallel speed | build-tooling1-6 |
| postcss.config.js, Dashboard.module.css | PostCSS/autoprefixer and CSS Modules' own scoped class names | build-tooling1-7 |
| The dynamic import() on click | Code splitting — the settings panel loads only when actually needed | build-tooling1-8 |
Coding Challenges
Explain why the .env file's variable is named VITE_API_URL rather than just API_URL, and explain what would happen to that value if the VITE_ prefix were removed.
📄 View solutionTrace what happens when a user clicks the settings button in this capstone's own main.js. Which chapter's own concept does this exercise, and what real benefit does it provide for the very first page load, before the button is ever clicked?
📄 View solutionPick three rows from this chapter's own chapter-attribution table and explain, in one or two sentences each, exactly which piece of this capstone's configuration draws on that chapter's material and why it was needed here.
📄 View solutionChapter 9 Quick Reference — Course Recap
- build-tooling1-1 to -2 — why build tools exist, the dependency graph and entry-point model, CommonJS vs. ESM
- build-tooling1-3 to -4 — Webpack's loaders/plugins and its own real config-complexity trade-off, Babel/tsc transpilation and source maps
- build-tooling1-5 to -6 — Vite's native-ESM dev server as a direct response, and the real Go/Rust engineering reason it's fast
- build-tooling1-7 to -8 — CSS's own build pipeline (PostCSS, CSS Modules), and production optimization (tree shaking, code splitting, minification)
- build-tooling1-9 — all of the above, combined into one real, working project configuration
- This closes the Build Tooling course — the invisible layer between the code you write and the code the browser actually runs is no longer invisible