Nuxt & Universal SSR (50 Qs)•Part 3: Advanced Internals, Performance & Production (Senior / Staff)
How do you optimize bundle size and analyze dependencies in Nuxt?
senior LevelFormsPerformanceVue & Nuxt
In Simple Words:
nuxi analyze: Runs Rollup/Vite visualizer to identify bloated dependencies in both client and server bundles.- Component Prefixing & Shaking: Keep components in focused subdirectories so only referenced UI parts are bundled.
- Dynamic Import of Heavy Modules: Use dynamic
import()or async components for non-critical dialogs and heavy charting engines. - Font Optimization: Use
@nuxtjs/fontaineto eliminate layout shift (CLS) and@nuxtjs/google-fontsto download fonts locally.