5 answers

★ Best answer

Did you actually check what's making the bundle heavy, or are you just shooting in the dark? First thing is to use `next/image` if you've got unoptimized images (makes a brutal difference on mobile), then check if there are massive libraries you can swap out for lighter alternatives, and enable `swcMinify` in `next.config.js` if you don't have it already. Also try disabling source maps in production, add `incremental static regeneration` to pages that can be static, and use `React.memo` or `useMemo` on heavy components that are re-rendering pointlessly every route change. If you're still getting lag after all that, you need to profile with Chrome DevTools to see where it's actually choking, because sometimes the problem isn't the code but you're making too many requests or blocking fetches.

The first thing I'd check is whether you're using Next.js Image correctly, because unoptimized images absolutely tank performance on mobile. I'd also take a good look at your bundle size with `next/bundle-analyzer` to see which libraries are bloating your app too much. For navigation lag, try enabling `swcMinify` in next.config.js if you haven't already, and check if there are unnecessary requests on the client side - sometimes dynamic imports work but the content still makes calls you could cache with revalidation or ISR. Depending on which of your routes are the heaviest, precaching data with `getStaticProps` instead of loading everything on the client could help too.

The first thing I'd check is whether you're using Next.js Image correctly - lots of people load huge images without optimizing them and that absolutely kills performance, especially on mobile. Also check your bundle size with `next/bundle-analyzer` because you might have heavy libraries you don't actually need, and consider adding `swcMinify` to your config if you haven't already.

If navigation between pages is slow, the issue is probably that you're running heavy queries on the server without caching anything - try using `revalidateTag` or ISR so it doesn't recalculate everything each time. And in general, I'd check what's happening in DevTools (Network and Performance tabs) to see exactly where it's bottlenecking.

The first thing is to check what's making your app slow with Chrome's DevTools (Network and Performance tabs) because sometimes it's not Next.js but you're loading huge resources or running inefficient queries. After that, besides dynamic imports, try Image Optimization (make sure you're actually using `next/image`, not `<img>`), enable `swcMinify` in next.config.js if it's not already on, and check if you have bundle bloat with `npm run build` and bundle size analysis - a lot of times you're importing libraries you could replace with something lighter or that you don't even need on the client.

On mobile the problem tends to be way worse, so also kill unnecessary Javascript: if a section doesn't interact with anything, make it static with `generateStaticParams` or minimize what you're sending to the client. If the lag happens during navigation, it's probably an API calls or heavy calculations issue - consider moving that to a Route Handler or Server Action so you don't block the client.

The first thing I'd check is whether you're using Next.js `Image` correctly (with width/height defined and modern formats) because a slow app on mobile is usually a nightmare of unoptimized images. After that, take a look at your bundle with `next/bundle-analyzer` to see which libraries are bloating your code, because sometimes you bring in dependencies you could replace with something lighter, and also make sure you're doing server-side rendering where it makes sense instead of loading all the logic on the client.

Your answer

Log into answer.