For Vue Router, use () => import('./views/Page.vue') directly in route definitions.
Details
Async components in Vue 3 use defineAsyncComponent to wrap a dynamic import(). The bundler splits the component into a separate chunk that is loaded only when the component is first rendered. This reduces the initial JavaScript payload.
Trade-offs:
Loading delay — users see a spinner or blank space while the component loads
Error handling is required — network failures must be caught and displayed gracefully
Too many async components can cause a "waterfall" of sequential network requests
SSR requires special handling — the server must await all async components before sending HTML
When NOT to use:
For small, frequently used components — the overhead of a separate chunk is not worth it
For above-the-fold content that must render immediately
When the component is always needed — static import is simpler
Read the instructions and examples in this document.
Apply the patterns to your implementation, adapting to your specific context.
Verify your implementation against the details and edge cases listed above.
Harness Integration
Type: knowledge — this skill is a reference document, not a procedural workflow.
No tools or state — consumed as context by other skills and agents.
Success Criteria
The patterns described in this document are applied correctly in the implementation.
Edge cases and anti-patterns listed in this document are avoided.
1---2name: vue-async-components3description: Vue Async Components4metadata:5 source: https://skillmd.com/skills/intense-visions/vue-async-components6---7# Vue Async Components89> Load Vue components lazily to reduce initial bundle size using defineAsyncComponent1011## When to Use1213- A component is heavy (charts, editors, maps) and not needed on initial render14- Implementing route-based code splitting in a Vue Router application15- Conditionally loading components behind feature flags or user interactions1617## Instructions18191. Use `defineAsyncComponent(() => import('./HeavyComponent.vue'))` to lazy-load.202. Provide `loadingComponent` and `errorComponent` options for UX during loading.213. Set a `delay` (ms) before showing the loading component to avoid flicker.224. Wrap async components in `<Suspense>` for coordinated loading states.2324```typescript25import { defineAsyncComponent } from 'vue';2627const AsyncChart = defineAsyncComponent({28 loader: () => import('./Chart.vue'),29 loadingComponent: LoadingSpinner,30 errorComponent: ErrorDisplay,31 delay: 200,32 timeout: 10000,33});34```35365. For Vue Router, use `() => import('./views/Page.vue')` directly in route definitions.3738## Details3940Async components in Vue 3 use `defineAsyncComponent` to wrap a dynamic `import()`. The bundler splits the component into a separate chunk that is loaded only when the component is first rendered. This reduces the initial JavaScript payload.4142**Trade-offs:**4344- Loading delay — users see a spinner or blank space while the component loads45- Error handling is required — network failures must be caught and displayed gracefully46- Too many async components can cause a "waterfall" of sequential network requests47- SSR requires special handling — the server must await all async components before sending HTML4849**When NOT to use:**5051- For small, frequently used components — the overhead of a separate chunk is not worth it52- For above-the-fold content that must render immediately53- When the component is always needed — static import is simpler5455## Source5657https://patterns.dev/vue/async-components5859## Process60611. Read the instructions and examples in this document.622. Apply the patterns to your implementation, adapting to your specific context.633. Verify your implementation against the details and edge cases listed above.6465## Harness Integration6667- **Type:** knowledge — this skill is a reference document, not a procedural workflow.68- **No tools or state** — consumed as context by other skills and agents.6970## Success Criteria7172- The patterns described in this document are applied correctly in the implementation.73- Edge cases and anti-patterns listed in this document are avoided.
Run npx get-skill add intense-visions/vue-async-components in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Vue Async Components It is listed under Web & Frontend on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Intense-Visions (@intense-visions) published this skill. Their other Agent Skills are listed on their SkillMD profile.