Vite, the hassle-free alternative to Webpack
My favourite aspect of Vite is that it’s fast with a capital F and supports JSX, Vue single-file components and TypeScript out of the box, with zero configuration. Just create your TypeScript/JSX file and Vite will parse it with zero hassle, in milliseconds.
The recommended way to create a project using Vite is by running the command
npm init vite in the command line.
You’ll be asked to write the project name and which framework you want to use (if you want to use one). Once the project is created, you run
npm install to install dependencies and then you can start creating and editing JS and HTML files.
Like Webpack, it has a built-in development server, that you can start with the command
npx vite. When you need to create the production build, run
npx vite build and everything will be built in the /dist/ folder.
The big drawback is that it doesn’t have any tool for Server-Side Rendering (SSR) yet. They are working on it, but it’s still experimental and not recommended for production.
If your project already uses Webpack and you’re satisfied with it, there’s no reason to migrate to Vite. But if you’re creating a new project, I highly recommend giving Vite a try.