Okay, let's do a quick summary of what we saw so far. Summary of Vite. Vite has a super fast development experience, and it has a great bundle output using rollup when building for production, which is also supported by legacy browsers, if needed. So Vite is awesome.
One common question is if Vite is made for Vue.js, and that's because it is made from the creator of the Vue.js framework, M1U, but the answer to that question is no, and to be honest, that will be unfair. Imagine that if you developers, they had to wait half a second to start at a server, but then React developers have to wait 30 seconds or sometimes like 20 minutes to work. That would make it a bad monopoly for Vue.js, but no, no, I'm kidding now, that's not the case. Vite is available for all the JavaScript frameworks. And actually, Vite is framework agnostic, which means that Vite provides a blazing fast development environment for Vue.js, React.js, Preact, Svelte and even more.
When you're going to create a Vite application, you run this command npm init vite at latest, and then you specify the project name, and then you can choose what framework you want to use, Vanilla, Vue, React, Preact, et cetera. And these are just the official plugins that ship within Vite. There are also many other boilerplates and templates you can use with Vite that are created from the community.
I stumbled upon this example, or this compile on Twitter. This is the CEO of Repl.it, and here they compare the Create React app versus the Vite React dev server. So look at this, I was not from scratch. On the left, we have the Create React app, on the right we have the Vite React. Vite React starts a bit later, like the click play a bit later, but look at how fast it is, this is record time. Here we can already see the React application running, while on the left it takes a while. Actually, we need to wait for almost the end of the video, about 40 seconds, to see just the application running. So this is a massive difference, and fun fact, after they made this comparison on Twitter, I think a few months later at the Replic, they replaced how they do the bundling for React to use Vite React. So now if you make React applications on Replic, they are way, way faster. And I think they also use Vite now for most of the JavaScript apps you can run on their website so that's a great use case where the dev server could even improve your production performance. But this is a rare use case of course.
Now Vite is also capable of server-side rendering and static site generation, which is really great news. There's also VitePress, which is a static site generator built on top of Vite. And VitePress is great for creating documentation and blogs, it's really, really fast. And it is like ViewPress, but lighter and faster. And I want to clarify that it is not coupled to Vite projects, so we don't need to have a Vite project to use Vite, VitePress, because VitePress can be used in any JavaScript project, it just uses Vite under the hood. So it can be inside a React app, a View app, a Vue CLI app, whatever. And VitePress is still an early walk-in progress version.
Comments