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

Output folder not being created on build.

joebentaylor1995 opened this issue · comments

After battling with 10 errors for 3 images in the console log for a couple of hours I realised, that when running next build && next-image-export-optimizer and then serving this, the assets folder for the optimised images never gets made or generated.

I have the exact same config as the docs, but i looked in the out folder and there are no optimised images folder anywhere.

Using Next 14.1.0
Screenshot 2024-01-29 at 17 38 40

Hi @joebentaylor1995,

Just to be sure: did you change the build script in package.json?

Yes i did (it doesnt have the next export as next config is suggested to have the export enabled under output: 'export')
Screenshot 2024-01-29 at 18 34 12

So, i usually run: npm run build && npm run serve to view locally the entire build

@joebentaylor1995 Do you only have remote images? Have you created a remoteOptimizedImages.js as detailed in the README?

I just tested the library with the newest Next.js version and the optimized images are generated as expected.

What is the terminal output for the build script?

No, my images are all local.

My terminal output:
Screenshot 2024-01-30 at 12 43 50

It seems that you have no pictures in the "public/images" folder, and not used static import for images. In your posted example above you are using a remote image.

How are you using the ExportedImage component?

Og theres plenty of images in the public folder...

The dummyData images are what im trying to use

Screenshot 2024-01-30 at 12 49 10

DummyData as a const in page.jsx

passed via props
Screenshot 2024-01-30 at 12 49 53

into this:
Screenshot 2024-01-30 at 12 49 45

In your next.config.js you specified "public/images" as the image folder where this library looks for images. Change that to "public/dummydata" or move all your images to the "public/images" folder...

Okay,. will give that a go now, I may have overlooked the folder

I think we can close this now, thanks for the help @Niels-IO