From harness-claude
Loads Vue components lazily with defineAsyncComponent to cut initial bundle size. Ideal for heavy components (charts, maps), route splitting, or feature flags.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Load Vue components lazily to reduce initial bundle size using defineAsyncComponent
Enforces Vue 3 best practices with Composition API, <script setup>, and TypeScript. Covers reactivity gotchas, computed properties, performance optimizations, SSR, Volar, vue-tsc for .vue files, Vue Router, Pinia, Vite projects.
Provides patterns for Vue components including props validation with TypeScript, defaults, emits, slots, and provide/inject. Use when building reusable Vue components.
Enforces Vue 3 best practices using Composition API, <script setup>, TypeScript. Guides reactivity, SFC structure, component boundaries for .vue files, Router, Pinia, Vite projects.
Share bugs, ideas, or general feedback.
Load Vue components lazily to reduce initial bundle size using defineAsyncComponent
defineAsyncComponent(() => import('./HeavyComponent.vue')) to lazy-load.loadingComponent and errorComponent options for UX during loading.delay (ms) before showing the loading component to avoid flicker.<Suspense> for coordinated loading states.import { defineAsyncComponent } from 'vue';
const AsyncChart = defineAsyncComponent({
loader: () => import('./Chart.vue'),
loadingComponent: LoadingSpinner,
errorComponent: ErrorDisplay,
delay: 200,
timeout: 10000,
});
() => import('./views/Page.vue') directly in route definitions.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:
When NOT to use:
https://patterns.dev/vue/async-components