This One Fix Cut My Next.js App’s Load Time in Half

Third-party scripts are costing millions of dollars, here’s how to resolve it.

Image for -This One Fix Cut My Next.js App’s Load Time in Half

We all want super-fast apps.
But what if I told you that your app might be twice as slow as it needs to be — and the fix is ridiculously simple?

When I found it, I said to myself

“Are you kidding me 😂”

That was me a few weeks ago.

I was following all the best practices: using Next.js

  • Optimizing images
  • Lazy Loading
  • Other usual suspects.

Still, the app was sluggish.

Irritated? I know😠.

And in the back of my head, something felt off.
Read for free 👉here

Enter the Culprit: Unoptimized Third-Party Scripts

You know those marketing tools, analytics scripts, and chat widgets you casually paste into your <head> without even thinking for a sec about the performance?

Yeah, those.

I was loading three of them — all blocking the main thread and adding a solid 2+ seconds to my first contentful paint making my app’s performance slow.
In Next.js, these scripts were inside my _document.js, loading right at the top.

So even before my app could breathe, these scripts were demanding attention like stubborn children at a toy store🥺.

The Simple Fix: Next.js Script Optimization

I moved every non-critical script to use next/script with the strategy="lazyOnload" flag.

import Script from "next/script";
<Script
src="https://some-chat-widget.com/script.js"
strategy="lazyOnload"
/>

Guess what?

  • Load time dropped from 4.1s to 2.3s
  • Lighthouse's score shot up by 15 points

No other changes. Just smarter script loading.

Why This Matters (and Why You Should Check Yours)

Most devs focus on the big stuff — API speed, server rendering, and image compression as I was one of them.
But often, the real performance wins are hiding in plain sight.

And in frameworks like Next.js, these small tweaks can make your UX 10x better — without touching a single backend file and not doing any heavy lifting.

Quick Wins You Can Steal Today:

  • Check where you’re loading third-party scripts. To know more about script strategies you can read here
  • Use next/script with strategy="lazyOnload" for third-party scripts like chat support and social media widgets
  • Remove what’s not absolutely necessary (do you really need multiple analytics tools?)
  • Run your site through PageSpeed Insights and check what’s hurting your score. Pagespeed Insights
Giphy GIF -Quick Win

Final Thought

As devs, we sometimes chase the fancy stuff — micro frontends, edge rendering, and all that jazz and shiny big things.

But don’t underestimate and leave the simple, boring fixes.
Sometimes they’re the ones that make your app feel buttery smooth like the above one just worked for me.

Been there? Have your own “hidden culprit” story?
Drop it in the comments — I’d love to learn what worked for you too and what small things you have done to make your app faster, maybe it can help someone else.

At Dev Simplified, We Value Your Feedback 📊

👉 Want to write with us? Join us on our whatsapp channel

👉 Have any suggestions? Let us know in the comments!

👉 Subscribe for free and join our growing community!