一键导入
good-bundling
Use when modifying build config, vite.config, adding new packages, setting up code splitting, or working with module resolution and imports
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when modifying build config, vite.config, adding new packages, setting up code splitting, or working with module resolution and imports
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when writing or modifying UI components, interactive elements, forms, or any HTML structure - before finalizing markup
Use when implementing any new feature, writing components, or reviewing code structure. Covers 4 code quality principles from Toss Frontend Fundamentals.
Use when encountering a bug, unexpected behavior, or error in the frontend - before attempting any fix
基于 SOC 职业分类
| name | good-bundling |
| description | Use when modifying build config, vite.config, adding new packages, setting up code splitting, or working with module resolution and imports |
번들링은 여러 파일을 하나로 합치는 과정이다. 번들 크기를 줄이고 로딩 속도를 높이는 것이 목표.
import/require를 따라가며 모든 모듈 탐색번들러가 실제 사용되는 export만 포함하도록 불필요한 코드를 제거한다.
// ❌ 전체 라이브러리 import → lodash 전체가 번들에 포함
import _ from "lodash";
// ✅ named import → 사용하는 함수만 포함
import { debounce } from "lodash-es"; // es 버전이 tree-shaking 가능
Tree Shaking이 잘 안 되는 경우:
require)로 작성된 라이브러리index.ts barrel export 남용 (불필요한 모듈까지 참조됨)"sideEffects": false 설정 확인)라우트 단위로 lazy import를 적용하면 초기 번들 크기를 줄일 수 있다.
// 라우트별 lazy import
const LoginPage = lazy(() => import("./LoginPage"));
const DashboardPage = lazy(() => import("./DashboardPage"));
// 큰 라이브러리는 동적 import
const { default: Chart } = await import("chart.js");
// ❌ 전체 import
import _ from "lodash";
import * as R from "ramda";
// ✅ named import
import { debounce } from "lodash-es";
import { map } from "ramda";
barrel export(index.ts)는 DX를 높이지만 tree-shaking을 방해할 수 있다. 내부 모듈에서 서로 참조할 때는 직접 경로 import를 고려한다.
# 빌드 + 타입 체크 (tsc -b 포함)
pnpm --filter front build
# 번들 분석 (vite-bundle-visualizer 등)
pnpm --filter front build --mode analyze