01
시작하기
프로젝트 생성
템플릿으로 프로젝트를 스캐폴딩합니다.
vite
# npm create vite@latest my-app -- --template vue
# npm create vite@latest my-app -- --template react-ts설정
플러그인을 포함한 Vite 설정입니다.
vite
// vite.config.ts
import { defineConfig } from "vite";
export default defineConfig({
plugins: [vue()],
server: { port: 3000 },
});개발/빌드
세 가지 주요 명령어입니다.
vite
# vite # dev server
# vite build # production build
# vite preview # preview build02
주요 기능
플러그인
플러그인으로 Vite 기능을 확장합니다.
vite
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
});환경 변수
VITE_ 접두사가 붙은 환경 변수만 클라이언트에 노출됩니다.
vite
import.meta.env.VITE_API_URL
// .env
VITE_API_URL=https://api.example.com프록시
개발 중 API 요청을 프록시합니다.
vite
server: {
proxy: {
"/api": "http://localhost:8080",
},
}Was this helpful?