Get Started with Vite.

Setting up a Vite React application

What is Vite?

  • Vite (or quick, in French).
  • Created by Evan You (also the creator of Vue.js),
  • Vite is a build tool that relies on ECMAScript 6’s Module support.
  • Before the ES modules were invented, developers used bundlers such as Web Pack, Rollup, and Parcel to transpile source modules into files that can run in the browser. These bundlers rebuild & rebundle your application every time you save a file.
  • But with a large-scale project coupled with complexity, transpiling thousands of modules leads to low performance and longer loading time to open on the browser or changes to reflect.
  • Vite solves the problem of slow server start and slow updates by not using bundlers during development, the startup speed and compilation time is greatly reduced, thereby improving the development experience for frontend developers.
  • Vite then uses Rollup to ship bundled codes for production.

Prerequisites

  • Latest Nodejs version installed
  • Knowledge of command terminal

To Set up Vite Application.

  1. Install Vite using NPM or Yarn package manager, run the command on your terminal,
yarn create vite
or
npm init vite@latest
Select react
Select react-ts
Install React and Typescript packages
yarn dev
or
npm run dev

Optional

yarn create vite project-name -template react-tsor
#npm 6.x
npm init vite@latest project-name --template react-ts
or
#npm 7+, extra double-dash is needed:
npm init vite@latest project-name -- --template react-ts

Useful resources

--

--

Software developer. Imaginative. I love to try,. I write to relearn while sharing the knowledge.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sandygoodnews

Software developer. Imaginative. I love to try,. I write to relearn while sharing the knowledge.