stack-analysis
CHAPTER 27 / 90
읽기 약 2분
FUNCTION
Vite vs Webpack vs Turbopack: 빌드 도구
핵심 개념
esbuild·SWC·HMR 비교·Vite 설정 — 개발 속도 10배.
본문
빌드 도구 비교
| 도구 | 개발 시작 | HMR | 프로덕션 빌드 | 적합 |
|---|---|---|---|---|
| Webpack 5 | 30s | 500ms | 90s | 레거시·복잡 |
| Vite | 1s | 50ms | 30s | 신규 SPA·라이브러리 |
| Turbopack (Next 15+) | 2s | 100ms | 45s | Next.js 표준 |
| Parcel | 3s | 200ms | 60s | 제로 설정 |Vite 설정
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import path from 'path';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
plugins: [react(), tsconfigPaths()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
},
},
},
build: {
target: 'es2020',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
'ui-vendor': ['@radix-ui/react-dialog', 'framer-motion'],
},
},
},
},
optimizeDeps: {
include: ['react', 'react-dom'],
},
});환경 변수
// .env.development
VITE_API_URL=http://localhost:8080
// 사용 (자동 타입)
const url = import.meta.env.VITE_API_URL;
// env.d.ts
interface ImportMetaEnv {
readonly VITE_API_URL: string;
readonly VITE_FEATURE_FLAG_X: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}ESM vs CommonJS
// ESM (Vite/Next 권장)
import { foo } from './bar.js';
export default function() {}
// CommonJS (Node.js 레거시)
const { foo } = require('./bar.js');
module.exports = function() {};
// package.json — type: "module"
{
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
}
}번들 분할 전략
// rollup-plugin-visualizer로 분석
import { visualizer } from 'rollup-plugin-visualizer';
build: {
rollupOptions: {
plugins: [visualizer({ open: true, filename: 'dist/stats.html' })],
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
if (id.includes('react')) return 'react-vendor';
if (id.includes('@radix-ui')) return 'ui-vendor';
if (id.includes('lodash')) return 'util-vendor';
return 'vendor';
}
},
},
},
}다음 챕터
CH.28 "ESLint + Prettier + Husky" — 코드 품질.
AI 프롬프트
🤖 AI에게 잘 물어보는 법 — 모델·전략별 프롬프트
Claude
무료: Sonnet 4.6 / Pro $20/mo: Opus 4.6
내 코드의 빌드 도구 부분을 분석해서 실전 분석 + 개선 우선순위를 알려줘.
ChatGPT
무료: GPT-5.5 / Plus $20/mo: GPT-5.5 Pro
빌드 도구 관련 인기 라이브러리/패턴 5개를 비교 분석해서 패턴 추출를 알려줘.
Gemini
무료: 2.5 Flash / Pro $19.99/mo: 3.1 Pro
내 프로젝트 전체에서 빌드 도구 최적화 가능 위치를 보고해줘.
Grok
무료: Grok 4.1 / SuperGrok $30/mo
2026년 한국 프론트엔드 시장의 빌드 도구 트렌드를 솔직히 알려줘.
⭐ 이것만 기억하세요
Vite vs Webpack vs Turbopack: 빌드 도구는 이 3가지만 확실히 잡으세요
1.Vite는 esbuild + ES modules로 개발 시작 1초 — Webpack 대비 30배
2.manualChunks로 vendor 분리 — 캐시 효율 + 점진 로드
3.Turbopack은 Next.js 15+ 기본 — Webpack 대체
공유하기
진행도 27 / 90