Frontend School
DashboardProblemsLearnPracticeMock InterviewReportsStatsBuy Credits
DashboardProblemsLearnPracticeMock Interview
Frontend System Design Roadmap
  1. 1.HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)
  2. 2.TCP and TLS Handshakes: Connection Setup Costs
  3. 3.Browser Network Stack and Connection Pooling
  4. 4.GET vs POST and Idempotency in HTTP
  5. 5.The Critical Rendering Path (CRP)
  6. 6.DOM, CSSOM and the Render Tree
  7. 7.Layout, Paint and Compositing
  8. 8.Reflows and Repaints Explained
  9. 9.Event Loop: Call Stack, Task and Microtask Queues
  10. 10.Async JavaScript: Promises and async/await
  11. 11.Web Workers: Multi-threading in the Browser
  12. 12.Browser Storage: Cookies, Web Storage, IndexedDB
  13. 13.Client-Side Storage: Limits and Security Risks
  14. 14.Choosing the Right Client-Side Storage
  15. 15.HTTP Caching: Cache-Control, ETag, Last-Modified
  16. 16.Browser-Level Caching Mechanisms
  17. 17.Cache Invalidation for Frontend Apps
  18. 18.Structuring a Large Single-Page App
  19. 19.Component-Based Architecture Principles
  20. 20.Props, State and Component Lifecycle
  21. 21.Module Bundling Basics
  22. 22.Core Web Vitals: LCP, INP and CLS
  23. 23.FCP and Time to Interactive (TTI) Explained
  24. 24.Measuring Performance: Lighthouse and WebPageTest
  25. 25.Asset Compression and Minification Basics
  26. 26.What Is a CDN and How Does It Work?
  27. 27.CDN Benefits: Latency, Availability, Offload
  28. 28.CDN Cache Behavior and Invalidation
  29. 29.Global State vs Local Component State
  30. 30.State Patterns: Redux, Zustand and Context
  31. 31.Data Fetching: React Query and SWR
  32. 32.Immutable Data in Frontend State
  33. 33.SSR vs CSR: Rendering Trade-offs
  34. 34.Hydration and Time to First Byte (TTFB)
  35. 35.Static Site Generation (SSG) for Speed and SEO
  36. 36.Incremental Static Regeneration (ISR)
  37. 37.Micro-Frontends: Core Principles
  38. 38.Micro-Frontend Integration Strategies
  39. 39.Communication Between Micro-Frontends
  40. 40.Micro-Frontends: Pros and Cons for Large Teams
  41. 41.Real-Time: Polling, SSE and WebSockets
  42. 42.Real-Time Use Cases: Chat, Alerts, Live Data
  43. 43.Designing a Real-Time Data Flow
  44. 44.Scaling WebSocket Connections
  45. 45.Responsive Images: srcset, sizes and picture
  46. 46.Modern Image Formats: WebP, AVIF, JPEG XL
  47. 47.Lazy Loading Images and Videos
  48. 48.Video Streaming: HLS, DASH, Adaptive Bitrate
  49. 49.REST and GraphQL for Frontend Engineers
  50. 50.Batching, Throttling and Debouncing API Calls
  51. 51.Handling API Errors in the Frontend
  52. 52.Authentication Flows: OAuth and JWT
  53. 53.Global Error Boundaries in React
  54. 54.Error Reporting: Sentry and LogRocket
  55. 55.Graceful Degradation and Fallback UIs
  56. 56.Real User Monitoring (RUM)
  57. 57.CORS: Cross-Origin Resource Sharing
  58. 58.Preventing XSS (Cross-Site Scripting)
  59. 59.CSRF Protection for Frontend Apps
  60. 60.Content Security Policy (CSP)
  61. 61.Storing Auth Tokens: Cookies vs localStorage
  62. 62.PWA Manifest and Installability
  63. 63.Service Workers: Lifecycle and Caching Strategies
  64. 64.Offline Support and Background Sync
  65. 65.Push Notifications for Web Apps
  66. 66.Webpack vs Vite vs Parcel
  67. 67.Code Splitting, Tree Shaking, Asset Optimization
  68. 68.Module Resolution and Hot Module Replacement
  69. 69.Monorepo Tooling: Nx and Lerna
  70. 70.Atomic Design for Component Libraries
  71. 71.Theming and Customization in Design Systems
  72. 72.Accessibility in Component Libraries
  73. 73.Component Library Docs, Testing and Versioning
  74. 74.Publishing and Consuming a Component Library
  75. 75.Full-Text Search: Levenshtein and Fuzzy Matching
  76. 76.Indexing Large Datasets in the Browser
  77. 77.Search Performance: Debouncing and Web Workers
  78. 78.Integrating Backend Search Services
  79. 79.Choosing a Chart Library: D3, Chart.js, Recharts
  80. 80.Rendering Large Datasets: Canvas vs SVG
  81. 81.Interactive, Responsive Data Visualizations
  82. 82.Data Fetching and Aggregation for Dashboards
  83. 83.A/B Test Design and Rollout Strategies
  84. 84.Client-Side vs Server-Side A/B Testing
  85. 85.Feature Flags and Remote Configuration
  86. 86.Experiment Data Collection and Analytics
Frontend System Design Roadmap
66

Frontend System Design · Lesson 66 of 86 · 5 min

Webpack vs Vite vs Parcel

This isn't about picking a favorite; it's about articulating the architectural trade-offs to justify your choice in a system design interview.

When asked to choose a build tool, your answer reveals your understanding of the entire development lifecycle, from developer experience to production performance. The "right" answer is never just a tool's name. It's a justification based on trade-offs.

The Core Trade-off: Bundle-based vs. Native ESM Dev Servers

The most significant difference between these tools is how they handle your code during development. This architectural choice directly impacts startup time and hot module replacement (HMR) speed.

Webpack and Parcel are traditional bundlers. On startup, they crawl your entire application from an entry point, build a dependency graph, and create bundles of JavaScript and CSS before the development server is ready. When you change a file, they often need to rebuild parts of the bundle. For a large application, this can mean waiting seconds or even minutes.

Vite takes a different approach. It leverages native ES Modules (ESM) in the browser. The dev server starts almost instantly because it doesn't bundle your application upfront. When your browser requests a source file like main.ts, Vite transforms and serves just that file. When that file imports another, the browser makes another request, and Vite serves it on demand.

This "unbundled" development is why Vite feels instantaneous. Dependencies in node_modules are pre-bundled into single ESM files using esbuild (written in Go), which is an order of magnitude faster than JavaScript-based bundlers.

For production, all three tools produce a highly optimized, static bundle of assets. Vite uses Rollup under the hood for its production build, which is a mature and highly capable bundler. The key difference is purely in the development experience.

When to Justify Webpack: Control and Ecosystem

Webpack is the established incumbent. Its power lies in its extreme configurability and a massive ecosystem of loaders and plugins. You should justify choosing Webpack when you need granular control over a complex or non-standard build process.

Scenarios where Webpack still excels:

  • Micro-frontends: Module Federation, a key feature for many micro-frontend architectures, is a first-class citizen in Webpack.
  • Complex legacy projects: Migrating a large, mature application with a bespoke Webpack config can be a significant undertaking. The existing setup is often a valid reason to stick with it.
  • Non-standard asset pipelines: If your build process involves compiling to WebAssembly, handling custom image formats, or other unique requirements, there is likely a Webpack plugin for it.

The trap: Dismissing Webpack as "old" or "slow." A senior answer acknowledges its maturity and power for specific, complex scenarios where "just works" tools fall short. The trade-off is clear: you sacrifice developer startup speed and configuration simplicity for ultimate control.

A typical Webpack config is explicit and verbose. This is its strength and weakness.

// webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  mode: 'development',
  entry: './src/main.ts',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
  resolve: {
    extensions: ['.ts', '.js'],
  },
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: 'ts-loader',
        exclude: /node_modules/,
      },
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader'],
      },
    ],
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './src/index.html',
    }),
  ],
  devServer: {
    static: './dist',
    hot: true,
  },
};

When to Justify Vite: Developer Experience and Speed

Choose Vite when developer velocity is a top priority. For most greenfield web applications, SPAs, and projects using modern frameworks like React, Vue, or Svelte, Vite is the default choice today.

The argument for Vite is simple: it makes development faster. Near-instant server starts and HMR updates create a tighter feedback loop, which is invaluable for productivity. It achieves this without sacrificing production quality, as it uses the highly-optimized Rollup bundler for production builds.

Vite also offers a great out-of-the-box experience. TypeScript, JSX, CSS, and PostCSS work with zero configuration. The config file (vite.config.ts) is often minimal or not needed at all for standard projects.

When to Justify Parcel: Simplicity and Prototyping

Parcel's philosophy is "zero configuration." You point it at an HTML file, and it figures out the rest, automatically transforming assets and installing dependencies as needed.

Justify Parcel for:

  • Quick prototypes and smaller projects: When you want to get from zero to a running app in seconds without writing a single line of config.
  • Teams less experienced with build tools: It lowers the barrier to entry and reduces the maintenance burden of a complex build setup.

The trap: Assuming zero-config means no-power. Parcel is capable, but when you need to deviate from its conventions, debugging or overriding its "magic" can be more difficult than editing an explicit Webpack config. The trade-off is simplicity for control. When things go wrong, a "black box" is harder to fix.

How to Frame Your Answer in an Interview

If an interviewer asks, "Which build tool would you use for a new project?", your response should start with a clarifying question, not a tool's name.

"My choice would depend on the project's scale, complexity, and the team's expertise. For a standard greenfield SPA with a modern framework, I'd default to Vite for its superior developer experience. However, if we were building a complex system with micro-frontends or needed a highly custom asset pipeline, I'd evaluate if Webpack's mature ecosystem and Module Federation support would be a better fit, despite the configuration overhead. For a quick prototype, I might use Parcel to get started immediately."

This answer demonstrates that you understand the tools are a means to an end and that the choice is a strategic one based on engineering trade-offs. You're not just following trends; you're making an informed decision.

Try it

Use npm create vite@latest to scaffold a new React+TS project. Start the dev server and time how long it takes to be ready. Now, change a CSS value and observe the HMR speed. This 15-minute exercise will give you a physical sense of the native ESM advantage.

Next: We'll go deeper into the optimizations these tools enable in Code Splitting, Tree Shaking, Asset Optimization.

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Push Notifications for Web Apps

Next

Code Splitting, Tree Shaking, Asset Optimization