Setting up a Vue development environment
Install Vue CLI, Vite, and configure your IDE for Vue.js development
- Course
- Vue fundamentals
- Lesson
- 2 of 9
- Level
- Beginner
- Reading time
- 15 minutes
Before building Vue applications, you need to set up a proper development environment. This lesson covers all the tools you'll need.
Prerequisites
Creating a Vue Project ¶
Option 1: Using Vite (Recommended) ¶
Vite is the recommended way to scaffold Vue projects. It's created by Evan You, the creator of Vue.
# Create a new Vue project with Vite
npm create vue@latest
# Or with specific template
npm create vite@latest my-vue-app -- --template vue-tsThe create-vue wizard asks several questions. A typical set of answers:
✔ Project name: my-vue-project
✔ Add TypeScript? Yes
✔ Add JSX Support? No
✔ Add Vue Router? Yes
✔ Add Pinia for state management? Yes
✔ Add Vitest for Unit Testing? Yes
✔ Add ESLint for code quality? Yes
✔ Add Prettier for formatting? YesAfter setup, run these commands:
cd my-vue-project
npm install
npm run devIt runs
http://localhost:5173.Option 2: Using Nuxt (Full-Stack) ¶
For full-stack applications with SSR, SSG, and more:
npx nuxi@latest init my-nuxt-app
cd my-nuxt-app
npm install
npm run devIDE Setup ¶
VS Code Extensions ¶
| Extension | What it does | ID |
|---|---|---|
| Vue - Official (Volar) | Essential extension for Vue.js development with TypeScript support | Vue.volar |
| TypeScript Vue Plugin | Enhanced TypeScript support for Vue SFCs | Vue.vscode-typescript-vue-plugin |
| ESLint | Integrates ESLint into VS Code for code quality | dbaeumer.vscode-eslint |
| Prettier | Code formatter supporting Vue SFC files | esbenp.prettier-vscode |
VS Code Settings ¶
Add these settings to your .vscode/settings.json:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[vue]": {
"editor.defaultFormatter": "Vue.volar"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib",
"vue.inlayHints.missingProps": true,
"vue.inlayHints.inlineHandlerLeading": true
}Essential Configuration Files ¶
Common Commands ¶
| Command | What it does |
|---|---|
npm run dev | Start the dev server |
npm run build | Build for production |
npm run preview | Preview the production build |
npm run test:unit | Run unit tests |
npm run lint | Lint and fix files |
Next Steps ¶
Next lesson
Template syntax and reactivity
Your Vue development environment is now set up! In the next lesson, we'll dive into Vue's template syntax and reactivity.
Tip