Build Tools & Bundlers
Vite, Webpack: transpile, bundle, and dev server.
Build Tools & Bundlers
Vite, Webpack: transpile, bundle, and dev server.
What you'll learn
- Transpile + bundle.
- Vite fast; Webpack flexible.
- Code split + hashed filenames.
Why we need a build step
Browsers do not run JSX, TypeScript, or npm-style imports natively. A build step transpiles (e.g. TS → JS, JSX → JS) and bundles (combines modules, resolves imports). In development you get a dev server with hot reload; for production you get minified, cacheable output.
Env variables (e.g. API URL) are often injected at build time. Source maps map bundled code back to source for debugging.
Vite and Webpack
Vite: uses native ES modules in dev for fast startup and HMR; uses Rollup for production builds. Simple config, fast by default. Webpack: very configurable, many loaders and plugins; more setup but handles complex cases.
Both support code splitting, env replacement, and loaders (e.g. for CSS, images, TypeScript). Vite is the default in many new React/Vue templates; Webpack is common in older or highly customized setups.
Code splitting and output
Use dynamic import() to load code on demand (e.g. per route or on user action). The bundler emits separate chunks that load when needed. Output filenames with a content hash so unchanged files keep the same URL and cache well.
[MDN – Client-side tools](https://developer.mozilla.org/en-US/docs/Learn_web_development/Getting_started).
Key takeaways
- Transpile + bundle.
- Vite fast; Webpack flexible.
- Code split + hashed filenames.
Related concepts
Explore topics that connect to this one.
Ready to see how this works in the cloud?
Switch to Career Paths for structured paths (e.g. Developer, DevOps) and provider-specific lessons.
View role-based pathsSign in to track your progress and mark lessons complete.
Discussion
Questions? Discuss in the community or start a thread below.
Join DiscordIn-app Q&A
Sign in to start or join a thread.