DEV Community

Srinu Web developer
Srinu Web developer

Posted on • Originally published at blog.srinudesetti.in

Next.js Image Optimization in Micro Frontend: The Complete Guide


Error: Invalid src prop (https://cdn.myapp.com/banner.jpg) on `next/image`,
hostname "cdn.myapp.com" is not configured under images in your next.config.js
Enter fullscreen mode Exit fullscreen mode

You ship a product page. Every image 404s. The host's remotePatterns allowlists the CDN. The Products remote does not.

In a hybrid Next.js micro frontend, every Next.js app has its own images block, every block has its own allowlist, and a missed entry only surfaces on the specific remote that needed it.

The full guide covers:

  • remotePatterns mirrored across host + every Next.js remote (and why)
  • Local vs production configs: the single http://localhost line that must NEVER ship
  • enableImageLoaderFix in NextFederationPlugin — the one-line fix for static images inside federated remotes
  • AVIF + WebP format negotiation with real payload comparisons (180 KB → 61 KB, 66% smaller)
  • deviceSizes + imageSizes tuning for your real rendered widths
  • minimumCacheTTL trade-offs during active deploys
  • The complete <Image> props guide: fill, sizes, priority, placeholder="blur", quality
  • Eight production gotchas (with the actual error messages and fixes)

Read the full guide with code examples → https://blog.srinudesetti.in/micro-frontend/nextjs/image-optimization-nextjs-micro-frontend

(Article includes complete next.config.js blocks for host + Products remote + Content remote, request-flow diagram, AVIF/WebP payload comparison, and decision tables for local vs production.)

Top comments (0)