Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No images are generated when distDir is not 'out'

metalmarker opened this issue · comments

It seems like no images are generated when the export folder is not the default (out).

Reproduction:

  • When next.config.js has the attribute distDir set to build, then no images are found ("Found 0 supported images in public/images, static folder and subdirectories and 0 remote image.")
  • When next.config.js doesn't have the distDir set, images are found as expected.

I'm working on the latest next.js and next-image-export-optimizer, with the app router, in case that matters.

commented

Hi @metalmarker,

I tried to reproduce the bug you are reporting. Unfortunately, it works in the example directory of this repo:
image

I have added the same configuration to my next.config.js and it still doesn't find images. There are two non-standard configuration choices that I'm using that might be the culprit:

  • I'm using the App Router
  • This project is part of a monorepo, so I have the experimental: { externalDir: true } setting in my next.config.js.
commented

HI @metalmarker,

I tried to replicate your setup but the images are being generated as expected. Can you post your next.config.js, please?

The only additional configuration attributes I have in addition to the next.config.js in your screenshot are experimental: { externalDir: true} and reactStrictMode: true (I removed the distDir: 'build' due to the issue)

commented

Possibly fixed by #166

commented

Hi @metalmarker Can you test it in the newest version 1.8.3 please?

Fixed. Thank you for the diligence, @Niels-IO!