SyntaxStudy
Sign Up
JavaScript Module Bundlers Overview
JavaScript Intermediate 5 min read

Module Bundlers Overview

Module Bundlers

Bundlers (Vite, webpack, Rollup, esbuild) combine modules into optimized files for the browser. They handle tree shaking, code splitting, and asset processing.

Example
// vite.config.js
import { defineConfig } from "vite";
export default defineConfig({
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ["react", "react-dom"],
        },
      },
    },
  },
});

// Use native ES modules in development:
// Vite serves unbundled modules directly to the browser
// — no slow rebuild step during development
Pro Tip

Vite uses native ES modules in development (instant server start) and Rollup for optimized production builds.