Vue.js and Nuxt.js Optimization: Tips & Tricks
Vue.js is fast. But only when used correctly.
Visitors wait for your site to load, then leave within three seconds. This isn’t science fiction—it’s the reality for many modern sites built with Vue.js or Nuxt.js.
First, a quick scope:
- Vue.js is among the most popular JavaScript frameworks for building web apps.
- Nuxt.js is a meta framework that lets Vue.js run on the server as well, boosting performance.
Effective optimization isn’t a niche technical task. It’s an investment that shows up as higher conversions, better search rankings, and happier users.
Clients of PageSpeed.cz, such as Dr. Max and Airstop, achieve better results thanks to proper optimization.
Why speed matters for the web
You might ask: “What if the site loads one second slower?” The reality is unforgiving. Speed directly impacts your business. Consider:
- Google has shown that pages meeting Web Vitals are 24% less likely to see users leave before load completes.
- E-commerce conversion rates typically drop by about 0.3% with every additional second of load time.
- Speed is a direct ranking factor in Google's algorithm.
Speed isn’t a luxury—it’s essential. Every millisecond counts, especially for sites built with modern JS frameworks like React or Vue.js, which ship more JavaScript and undergo more complex initialization.
But with the right approach, a Vue.js site can outperform many static pages.
Is Vue.js inherently slow? Debunking myths vs. reality
There’s a common belief that Vue.js and similar modern frameworks are slow by design. More JavaScript means more work to optimize, but Vue.js is engineered for performance, and Vue-powered sites can be very fast.
Performance problems usually stem from human error, not the framework:
- Incorrect architecture: using SPA where SSR would be better.
- Missing optimization: ignoring proven best practices (some listed here).
- Testing only on fast devices: developers often miss real-world issues and the so-called Performance Inequality Gap.
Vue.js can be fast by itself. The key is using it correctly and knowing when to apply which technique.
How to tell if your Vue.js site is underperforming
You might think your site is fine because it feels fast. Are you testing properly?
Tip: Measure your site’s speed at PageSpeed.cz.
Core Web Vitals: The Three Pillars of Speed
Core Web Vitals are three key metrics that determine how fast your site feels to users:
- Largest Contentful Paint (LCP) — Loading speed. Time to render the largest visible element on the page. Target: ≤ 2.5 seconds
- Interaction to Next Paint (INP) — Interaction speed. Responsiveness to user actions (clicks, taps). Target: ≤ 200 ms
- Cumulative Layout Shift (CLS) — Layout stability. Target: ≤ 0.1
Seven steps to a faster Vue.js site
Now for the core ideas. Here are practical tips to speed up your Vue.js site.
1. Right architecture: SSR and SSG instead of a pure SPA
The acronyms look daunting, but the idea is simple. Instead of the site waiting for JavaScript to run on the client, send the user a ready-made HTML.
Think of it as the difference between getting a ready-made meal vs. waiting for someone to cook it at your table.
Key takeaways:
- SPA (Single Page Application) loads most stuff up front and handles most work on the client, but starts slowly. It’s like cooking the meal at the table—an outdated approach.
- Server-Side Rendering (SSR) means the server generates HTML for each page. The user sees content immediately while interactive JS loads in the background.
- Static Site Generation (SSG) pre-renders HTML at build time and serves static files. It’s the fastest option but not ideal for shops or highly dynamic sites.
- A Hybrid approach combines both, by page type (static for blogs, dynamic for others). Consider this for your site.
Here’s a schematic SSR config for the server-side Vue solution Nuxt.js:
// nuxt.config.ts or nuxt.config.js for SSR
export default defineNuxtConfig({
// Enable server-side rendering
ssr: true,
nitro: {
prerender: {
// Pre-render static pages
routes: ['/about', '/contact', '/blog']
}
}
});
If speed matters, avoid a pure client-side SPA. Consider SSR/SSG combos.
2. Progressive rendering: Lazy loading as a lifeline
Picture building a house. You don’t lay every brick at once; you proceed as needed. Your Vue.js site should do the same.
How to implement?
- Lazy loading components: load them only when needed—typically items not visible on the first screen or used infrequently.
- Progressive hydration: JavaScript progressively attaches to server-generated HTML. The content appears immediately while interactivity is added where it’s needed.
- Code splitting: the bundler divides code into smaller chunks, so only the necessary parts are fetched on demand.
Example of lazy loading (inline):
-
Lazy loading a component: const HeavyChart = defineAsyncComponent(() => import('./HeavyChart.vue'));
-
With a loader (e.g., spinner): const HeavyTable = defineAsyncComponent({ loader: () => import('./HeavyTable.vue'), loadingComponent: LoadingSpinner, delay: 200 });
Load only what’s visible. The rest can wait.
Tip: We have a full article dedicated to lazy loading in general.
3. Bundle size: Less JavaScript, faster
Every kilobyte of JavaScript must be downloaded, parsed, and executed. On slow devices or networks, that can be lengthy. Keep your JS bundle as small as possible:
- Tree-shaking: automatically removes unused code. Modern bundlers like Webpack or Vite do this, but you must import things correctly.
- Audit dependencies: regularly review which libraries you actually need. Bloat often comes from libraries you no longer use.
- Compress files: can shrink bundle size by up to 70%. Modern Brotli compression outperforms Gzip.
Bad vs Good imports (inline snippets):
- Bad: import _ from 'lodash';
- Good: import { debounce } from 'lodash-es';
- Even better: a simple custom debounce: const debounce = (fn, delay) => { let timeoutId; return (...args) => { clearTimeout(timeoutId); timeoutId = setTimeout(() => fn.apply(this, args), delay); }; };
Simple tip: bundlephobia.com shows the size of dependencies and suggests alternatives.
Every kilobyte counts. Keep the bundle lean.
4. Optimizing for better INP: Fast responses to clicks
INP measures how quickly the site responds to user actions. If a user clicks a button and nothing happens—or things feel slow—the experience suffers.
The main culprits are long tasks on the main thread (measured by TBT). When your JS is heavy, the browser can’t keep up with input.
Hydration in Vue.js (bringing the app to life) can tax the browser and hinder interactivity. We addressed this in Airstop.cz.
What to do?
- Use lazy hydration, especially for components users may not activate immediately (menus, modals, filters, footer, etc.).
- Debounce and throttle: limit function calls during rapid repeated actions (typing in a search field, scrolling).
- Reduce the DOM. A smaller DOM is the foundation. Aim for under 3,000 nodes.
Debounce example for search:
-
Debouncing for search — triggers 300 ms after the last keystroke import { debounce } from 'lodash-es'; const searchProducts = debounce((query) => { // search runs after a pause }, 300);
-
Throttle for scroll — fires at most every 100 ms import { throttle } from 'lodash-es'; const handleScroll = throttle(() => { // optimize scroll listener }, 100);
Heavy operations like filtering large data or complex calculations should move to the server via API calls.
Keep the browser’s main thread free. Users deserve instant feedback.
5. List virtualization: Thousands of items without slowdowns
If you have a list with thousands of products, articles, or comments, you can’t render them all at once. That would slow things down.
Virtualization renders only the visible items plus a small buffer, swapping elements as you scroll. It’s like reading a book—you don’t flip every page at once.
There are Vue-ready libraries that implement virtualization for you. The most popular are vue-virtual-scroller and vue-virtual-scroll-grid.
Virtualization can improve list performance by hundreds of percent, especially on mobile devices with limited power.
Render only what the user sees. Thousands of items can wait.
6. Images: Modern formats and lazy loading
Images often make up the bulk of a page’s data. Proper image optimization is one of the most effective speed boosts.
- Modern formats like WebP and AVIF offer 25–50% better compression than JPEG with preserved quality. Modern browsers support WebP.
- Responsive images: provide the right size for each device. Why load a 2000px-wide image on a 400px mobile screen?
- Lazy loading images: load images only when they enter the viewport. This dramatically speeds initial load.
- Placeholder images prevent layout shifts. Use blurred placeholders, colored backgrounds, or skeleton loaders—but use them carefully, as poor use can hurt speed.
Responsive images with lazy loading (example):

Optimize images carefully, especially if they’re your LCP element.
7. Profiling: Measuring is the basis of improvement
Without measurement you optimize blind.
Beyond the basics (synthetic tests and CrUX monitoring), which tools should you use?
- Chrome DevTools Performance panel shows where your code spends time. It helps identify which components render slowly or which functions tax the CPU. Learn more about Web Vitals in the browser.
- Vue DevTools provide Vue-specific metrics—which components re-render, how long mounts or updates take.
- Real User Monitoring (RUM) tracks real users on real devices with real networks. Lab tests matter, but RUM reveals the real experience. It’s the most accurate of the three speed-measurement types.
What you don’t measure, you can’t improve.
Advanced tips: CDN, prefetching, and modern technologies
If you’ve got the basics down, try these optimizations:
- Choose solid infrastructure and a Content Delivery Network (CDN). A CDN serves assets from the nearest location—like having stores in multiple towns. Use Cloudflare or AWS CloudFront.
- Optimize BFCache to speed up back/forward navigations with minimal effort.
- Speculation Rules API can bring intelligent navigation predictions, but implementation is more advanced—plan accordingly.
PageSpeed.cz successes: Real optimization results
Theory is nice, but does it translate to real gains? We’ve worked on several Vue.js projects where performance optimization made a big difference.
One example is the travel site Airstop.cz, where our DesignDev team helped during a redesign to improve user experience.
The project is ongoing, but we’ve already seen Core Web Vitals improvements by tens of percent:
[Case study: Airstop.cz image]
With Dr. Max, we already have green LCP and CLS scores, and we’re actively improving interactivity (INP). Examples of optimizations:
- Optimizing user interactions with loaders using a nextTick-based approach across the site.
- Speeding up interactions in product-wide search.
- Optimizing GTM-triggered events.
Each project is unique, but the principles remain: post-development optimization is essential to maintain speed. Start with measurement and implement changes gradually.
How PageSpeed.cz monitoring helps you
In our PageSpeed.cz speed monitoring, you can track Core Web Vitals in real time and pinpoint issues. We often see Vue.js sites struggle with large JavaScript bundles or slow hydration.
[Drmax.cz CWV evolution image]
Measurement is the baseline. Without data you optimize blind.
Our PageSpeed.cz Monitoring PLUS provides:
- Continuous monitoring of Core Web Vitals from CrUX data and synthetic tests.
- Benchmarking against competitors in your industry and domain data.
- Detailed analyses from every test run.
- Watchdog and alerting for performance degradation with rapid response options.
We strongly recommend automating monitoring so you can focus on optimizations.
Conclusion: Speed as a competitive advantage
Optimizing Vue.js apps isn’t a one-off task; it’s an ongoing process. Vue.js itself isn’t slow—the issues come from misuse or under-optimization.
Start with Core Web Vitals, consider SSR, and follow the steps above. Remember: every millisecond matters, and speed can be your competitive edge.
Not sure what to do next? Reach out to us.
The result of Vue.js optimization is a faster site, happier users, better search rankings, and, ultimately, higher revenue.
Tagy:Vue.jsOptimalizaceCore Web Vitals
PředchozíOptimalizace ShoptetuDalšíOptimalizace rychlosti WordPressu