Setting Up Your Vue Development Environment
Before building Vue applications, you need to set up a proper development environment. This lesson covers all the tools you'll need.
Prerequisites
Make sure you have Node.js (v18+) installed. Visit nodejs.org if you haven't already.
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.
bash# Create a new Vue project with Vite npm create vue@latest # Or with specific template npm create vite@latest my-vue-app -- --template vue-ts
Interactive Setup
The create-vue wizard will ask you several questions:
After setup, run these commands:
bashcd my-vue-project npm install npm run dev
Success!
Your Vue app is now running at http://localhost:5173
Option 2: Using Nuxt (Full-Stack)
For full-stack applications with SSR, SSG, and more:
bashnpx nuxi@latest init my-nuxt-app cd my-nuxt-app npm install npm run dev
Project Structure
my-vue-project/
├── 📁 node_modules/
├── 📁 public/
│ └── favicon.ico
├── 📁 src/
│ ├── 📁 assets/
│ │ └── main.css
│ ├── 📁 components/
│ │ └── HelloWorld.vue
│ ├── 📁 router/
│ │ └── index.ts
│ ├── 📁 stores/
│ │ └── counter.ts
│ ├── 📁 views/
│ │ ├── HomeView.vue
│ │ └── AboutView.vue
│ ├── App.vue
│ └── main.ts
├── .eslintrc.cjs
├── .prettierrc.json
├── index.html
├── package.json
├── tsconfig.json
└── vite.config.ts
IDE Setup
VS Code Extensions
Recommended Extensions
Vue
Vue - Official (Volar)
Essential extension for Vue.js development with TypeScript support
Vue.volarTS
TypeScript Vue Plugin
Enhanced TypeScript support for Vue SFCs
Vue.vscode-typescript-vue-pluginES
ESLint
Integrates ESLint into VS Code for code quality
dbaeumer.vscode-eslintP
Prettier
Code formatter supporting Vue SFC files
esbenp.prettier-vscodeVS Code Settings
Add these settings to your .vscode/settings.json:
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
npm run devStart dev servernpm run buildBuild for productionnpm run previewPreview production buildnpm run test:unitRun unit testsnpm run lintLint and fix filesNext Steps
Your Vue development environment is now set up! In the next lesson, we'll dive into Vue's template syntax and reactivity.
💡 Pro Tip
Use Vue DevTools browser extension for debugging Vue applications. It provides component inspection, state management, and performance profiling.