Create react app vs Vite : A test to see which is faster at building your react app starter files
Summary
TLDRThe video provides a demonstration of using Vite, a build tool, to create React applications faster than the typical Create React App (CRA) method. It highlights that while CRA often takes about three to four minutes to set up, Vite can accomplish the same setup in about 55 seconds. The presenter walks through the steps of setting up a React app using both methods, measuring the time it takes for each. Vite is noted for its speed and ease of setup, requiring Node.js version 12 or above. The video concludes with a demonstration of the quick installation of a React app using Vite, encouraging viewers to try Vite for faster setups.
Takeaways
- 🚀 Using Vite is significantly faster than Create React App.
- 🔧 Vite requires Node.js version 12 or above.
- 📑 Vite was initially designed for Vue but supports React, Svelte, and others.
- 🕒 Create React App typically takes 3-4 minutes to set up.
- ⚡ Vite can set up a React app in under a minute.
- 🖥️ Vite automatically sets up local servers for development.
- 💾 Ensure your Node.js and npm versions are compatible before starting.
- ⏱️ Testing with time measurements highlights Vite's speed advantage.
- 📝 Video provides step-by-step instructions for both tools.
- 👍 Vite simplifies the initialization process for React apps.
Timeline
- 00:00:00 - 00:05:00
The video introduces a faster method to start React applications using the tool Vite, instead of the Create React App. The presenter highlights the time savings, noting that Create React App takes about 3 minutes and 52 seconds, while Vite only takes 55 seconds. The speaker explains their usual process of using npx create-react-app which typically takes three to four minutes to set up, and contrasts this with the use of Vite. Vite, although initially designed for Vue.js, supports multiple frameworks including React. The primary requirement mentioned to utilize Vite is having Node.js version 12 or higher. The presenter checks the Node version on their system, confirming it meets the necessary specifications for using Vite.
- 00:05:00 - 00:10:13
The presenter demonstrates the installation process using both Create React App and Vite. For Create React App, they check the necessary versions of Node.js and npm, then proceed to install and start a local server, noting the process takes about four minutes. Moving on to Vite, the presenter goes through the installation steps, emphasizing the speed—installing a React app with Vite takes about 3.8 seconds plus 12 seconds for npm install. They guide through the commands used, modify the provided template directory name and template to fit React, and conclude by running the app on a local server, which takes a total of 55 seconds, significantly faster than Create React App. They encourage viewers to subscribe for more videos.
Mind Map
Video Q&A
What is Vite?
Vite is a build tool that helps set up development environments for JavaScript frameworks like React and Vue faster than traditional tools.
Why is Vite faster than Create React App?
Vite is designed to offer a faster setup by optimizing the build and refresh speeds, hence reducing the time required to set up a React project.
What are the requirements to use Vite?
You need to have Node.js version 12 or above to use Vite.
Can Vite be used for frameworks other than React?
Yes, Vite supports other frameworks like Vue, Svelte, and others.
How much time can I save using Vite instead of Create React App?
You can significantly reduce setup time, potentially setting up a React app in about 55 seconds compared to several minutes with Create React App.
Does Vite support development servers?
Yes, Vite automatically sets up local development servers for your projects.
Is there a difference in commands between npm versions when using Vite?
Yes, you need to use different commands based on whether you are using npm version 6 or 7+.
View more video summaries
- Vite
- React
- Create React App
- Build Tool
- Node.js
- NPM
- Fast Setup
- Web Development
- JavaScript