Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. JavaScript Course

Lesson 24 of 55 · javascript

Modules Bundlers – Webpack, Rollup, Vite

Duration: 12 mins

While native <script type="module"> works, bundlers give you:

  • Transpilation (Babel) to older browsers.
  • Tree‑shaking – remove dead code.
  • Asset handling (CSS, images, fonts).

Basic Vite config (ESM)

npm create vite@latest my-app -- --template vanilla
cd my-app
npm install
npm run dev

index.html

<script type="module" src="/main.js"></script>

main.js

import { greet } from './greet.js';
greet();
Previous: Prototype Chain & InheritanceNext: JavaScript Performance – Profiling & Optimisation