0
0
Vueframework~5 mins

Vue CLI and Vite setup

Choose your learning style9 modes available
Introduction

Vue CLI and Vite help you start a Vue project quickly with all tools ready. They save time and make development easier.

You want to create a new Vue app with a simple setup.
You need a fast development server with live reload.
You want to build and bundle your Vue app for production.
You want to use plugins and presets easily.
You want to try modern tools that improve coding speed.
Syntax
Vue
npm create vue@latest
# or
npm install -g @vue/cli
vue create my-project

# For Vite
npm create vite@latest my-vite-app -- --template vue
cd my-vite-app
npm install
npm run dev

Vue CLI uses vue create to start projects with options.

Vite uses npm create vite@latest for a faster, simpler setup.

Examples
This installs Vue CLI globally and creates a new Vue project with prompts.
Vue
npm install -g @vue/cli
vue create my-vue-app
This creates a new Vue app using Vite, installs dependencies, and starts the dev server.
Vue
npm create vite@latest my-vite-app -- --template vue
cd my-vite-app
npm install
npm run dev
Sample Program

This sequence creates a Vue app using Vite, installs needed packages, and runs the app on a local server.

Vue
# Steps to create and run a Vue app with Vite
npm create vite@latest my-vite-app -- --template vue
cd my-vite-app
npm install
npm run dev
OutputSuccess
Important Notes

Vue CLI offers more configuration options during setup.

Vite is faster and simpler, great for modern Vue projects.

Both tools provide hot reload so your changes show instantly in the browser.

Summary

Vue CLI and Vite help start Vue projects quickly and easily.

Vue CLI is more configurable; Vite is faster and simpler.

Both provide live reload and build tools for smooth development.