Performance: Plugin installation and usage
MEDIUM IMPACT
This affects page load speed and initial rendering time because plugins add code and sometimes extra DOM elements or styles.
import { createApp, defineAsyncComponent } from 'vue'; const app = createApp(App); // Lazy load plugin component only when needed app.component('LazyFeature', defineAsyncComponent(() => import('heavy-plugin'))); app.mount('#app');
import { createApp } from 'vue'; import HeavyPlugin from 'heavy-plugin'; const app = createApp(App); app.use(HeavyPlugin); app.mount('#app');
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Install large plugin upfront | High (adds many nodes) | Multiple reflows | High paint cost | [X] Bad |
| Lazy load plugin components | Low (only when used) | Single reflow | Low paint cost | [OK] Good |