MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Setting Up Modern React with Vite0%
Study Materials
React.js for BeginnersProgress 0%
1.1Why React and Single-Page Architecture1.2Setting Up Modern React with Vite1.3React Project Directory Structure and Entry Points1.4Virtual DOM and React Render Cycle Explained
HomeTutorialsReact.js for BeginnersSetting Up Modern React with Vite
React Project Directory Structure and Entry Points

Setting Up Modern React with Vite

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

1. Why Vite Replaced Create React App

For many years, create-react-app (CRA) was the standard boilerplate tool for bootstrapping React projects. CRA relied internally on Webpack, which bundled every JavaScript file, CSS file, and third-party dependency into a single massive memory bundle before starting the local development server. As applications expanded, cold-start build times stretched into minutes, and Hot Module Replacement (HMR) experienced noticeable lag.

Vite (pronounced veet, French for "quick") fundamentally redefined front-end build tooling by capitalizing on modern browser capabilities and native ES Modules (ESM):

  • Instant Cold Server Start: Vite does not bundle source code upfront during development. Instead, it serves source code over native ESM, allowing the browser to load individual modules on demand as requested.
  • Lightning-Fast HMR: Utilizing esbuild (written in Go), Vite pre-bundles external dependencies 10 to 100 times faster than JavaScript-based bundlers. Changes to components update almost instantaneously in the browser without losing component state.
  • Optimized Production Bundles: When deploying to production, Vite employs Rollup under the hood to output highly optimized, tree-shaken, and chunk-split static assets.
1Webpack / CRA Dev Server:
2[Entry] ──> [Bundle 500+ modules into memory] ──> [Server Ready (Slow)]
3 
4Vite Dev Server:
5[Start Server Instantly] ──> [Browser requests App.jsx via ESM] ──> [Transform App.jsx on demand]

2. Prerequisites and Environment Verification

Before bootstrapping a modern React application, ensure you have the active Long-Term Support (LTS) release of Node.js installed on your workstation.

1# Verify Node.js version (Node 18.x or 20.x+ recommended)
2node -v
3# Example output: v20.14.0
4 
5# Verify npm (Node Package Manager)
6npm -v
7# Example output: 10.7.0

3. Scaffolding a New React Project

Execute the npm create vite@latest CLI command in your terminal. You can configure project parameters interactively or pass flags directly:

1# Initialize project using the React template
2npm create vite@latest msk-react-starter -- --template react
3 
4# Navigate into the project root directory
5cd msk-react-starter
6 
7# Install project dependencies listed in package.json
8npm install
9 
10# Launch the local development server
11npm run dev

The terminal will output the local network URL (typically http://localhost:5173). Opening this link in any modern browser displays your active Vite + React environment with live Hot Module Replacement enabled.

4. Understanding the Core Configuration Files

package.json

Specifies your application scripts, development tools, and production dependencies:

1{
2 "name": "msk-react-starter",
3 "private": true,
4 "version": "1.0.0",
5 "type": "module",
6 "scripts": {
7 "dev": "vite",
8 "build": "vite build",
9 "preview": "vite preview"
10 },
11 "dependencies": {
12 "react": "^18.3.1",
13 "react-dom": "^18.3.1"
14 },
15 "devDependencies": {
16 "@vitejs/plugin-react": "^4.3.0",
17 "vite": "^5.3.0"
18 }
19}

vite.config.js

The central build configuration file where official plugins such as @vitejs/plugin-react are registered:

1import { defineConfig } from 'vite';
2import react from '@vitejs/plugin-react';
3 
4// https://vitejs.dev/config/
5export default defineConfig({
6 plugins: [react()],
7 server: {
8 port: 3000,
9 open: true
10 }
11});

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
What major development feature allows Vite to start local development servers almost instantaneously?
Question 2
Which underlying tool does Vite use for high-speed dependency pre-bundling during development?
Question 3
What terminal command is used to launch the Vite local development server?
Question 4
By default, what port does the Vite development server bind to?
Question 5
Which file contains the list of installed packages, scripts, and project metadata in a React application?
Next Lesson

React Project Directory Structure and Entry Points

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Why React and Single-Page ArchitectureReact Project Directory Structure and Entry Points

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master React.js for Beginners with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext