9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
5.2 KiB
5.2 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-code-splitting | Code Splitting | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Code Splitting
매 한 줄
"매 bundle 의 chunk 의 분리, on-demand load 의 first-paint 단축". Code Splitting 은 dynamic
import()+ bundler chunking 의 결합 의 매 monolithic JS bundle 의 분해. 2026 Vite/Rspack/Turbopack 시대 에 route-level + component-level + vendor split 의 매 표준.
매 핵심
매 splitting 의 axis
- Route-based: 각 page 의 separate chunk — 매 SPA / Next.js 의 default
- Component-based: heavy component 의 lazy (Modal, Chart, Editor)
- Vendor:
node_modules의 separate chunk — long-term cache - Dynamic feature: locale, A/B variant 의 conditional load
매 mechanism
- Dynamic
import(): ECMAScript spec — Promise 의 return - Bundler 의 split point detection:
import()호출 의 chunk boundary - Manifest: hashed filename 의 mapping
- Preload / prefetch:
<link rel="preload/prefetch">hint
매 cost trade-off
- Pro: initial bundle 의 작아짐 → faster TTI
- Con: extra HTTP request, waterfall 위험 — preload 의 mitigate
매 응용
- Route-level lazy (React Router, Next.js).
- Modal / dialog (open 시 load).
- Heavy editor (Monaco, CodeMirror).
- Chart library (Recharts, ECharts).
- i18n locale chunk.
💻 패턴
React.lazy + Suspense
import { lazy, Suspense } from 'react';
const Settings = lazy(() => import('./Settings'));
export default function App() {
return (
<Suspense fallback={<Spinner />}>
<Settings />
</Suspense>
);
}
Next.js dynamic
import dynamic from 'next/dynamic';
const Chart = dynamic(() => import('@/components/Chart'), {
loading: () => <p>Loading chart...</p>,
ssr: false, // browser-only
});
export default function Dashboard() {
return <Chart data={data} />;
}
Route-level (React Router v6)
import { lazy } from 'react';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
const router = createBrowserRouter([
{ path: '/', lazy: () => import('./routes/Home') },
{ path: '/about', lazy: () => import('./routes/About') },
{ path: '/admin/*', lazy: () => import('./routes/Admin') },
]);
export default function App() {
return <RouterProvider router={router} />;
}
Vite의 manualChunks
// vite.config.ts
import { defineConfig } from 'vite';
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
react: ['react', 'react-dom'],
ui: ['@radix-ui/react-dialog', '@radix-ui/react-tabs'],
charts: ['recharts', 'd3'],
},
},
},
},
});
Webpack magic comment
const Editor = () => import(
/* webpackChunkName: "editor" */
/* webpackPrefetch: true */
'./Editor'
);
Conditional import (locale)
async function loadLocale(lang: string) {
const messages = await import(`./locales/${lang}.json`);
return messages.default;
}
Preload critical chunk
<link rel="modulepreload" href="/assets/Settings-abc123.js">
// React: preload on hover
<Link
to="/settings"
onMouseEnter={() => import('./Settings')}
>
Settings
</Link>
Module Federation (micro-frontend)
// host webpack.config.js
new ModuleFederationPlugin({
remotes: {
checkout: 'checkout@https://cdn/checkout/remoteEntry.js',
},
});
// usage
const Checkout = lazy(() => import('checkout/Cart'));
매 결정 기준
| 상황 | Approach |
|---|---|
| SPA, multi-page | Route-based split |
| Heavy modal / editor | lazy() + Suspense |
| Vendor lib stable | manualChunks vendor split |
| SSR + browser-only | dynamic({ ssr: false }) |
| Independent deploy | Module Federation |
| Hover-triggered | preload on intent |
기본값: route-based + heavy-component lazy + vendor chunk.
🔗 Graph
- 부모: Web Performance
- 변형: Module Federation
- 응용: Lazy-Loading-Strategies
- Adjacent: Vite · Next.js · Suspense
🤖 LLM 활용
언제: route lazy, heavy component 의 split, vendor chunking 코드 generation. 언제 X: 매 small app (10kb 의 split 의 overhead 가 더 큼).
❌ 안티패턴
- 너무 fine-grained split: 100개 chunk → request flood — 매 ~10-30 chunk 의 sweet spot.
- Waterfall: A → B → C 의 sequential — 매 parallel preload.
- Vendor chunk 의 무한 growth: dependency 추가 시 cache invalidation — 매 stable lib 만 vendor.
- Suspense 의 boundary 누락: error / blank screen.
ssr: false의 abuse: SEO 손실.
🧪 검증 / 중복
- Verified (Vite docs, Webpack docs, Next.js docs, React 19).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — splitting strategies + bundler config + MF |