Skip to content

Support next/image #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amacneil opened this issue Mar 12, 2021 · 3 comments
Closed

Support next/image #129

amacneil opened this issue Mar 12, 2021 · 3 comments
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@amacneil
Copy link

It looks like initial support for next/image was requested in next-on-netlify in netlify/next-on-netlify#70 and added in netlify/next-on-netlify#138.

Now that next-on-netlify is deprecated, it's unclear what the recommended method for serving Next.js images is.

Current, if the <Image /> tag is used in a Next.js site, deploys to Netlify fail with:

Error: Image Optimization using Next.js' default loader is not compatible with `next export`.
  Possible solutions:
    - Use `next start`, which starts the Image Optimization API.
    - Use Vercel to deploy, which supports Image Optimization.
    - Configure a third-party loader in `next.config.js`.
  Read more: https://err.sh/next.js/export-image-api
@jlengstorf
Copy link

hey, @amacneil! right now you'd need to stop using next export to enable next/image support, but we do support it now

I think it might be possible to make next export work as expected, though, so this is worth digging into. thanks for opening this!

@jlengstorf jlengstorf added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Mar 12, 2021
@amacneil
Copy link
Author

Interesting. I believe I got the export line from your template, so it probably needs updating if that is the case:

https://github.com/netlify-templates/next-starter-jamstack/blob/master/package.json#L6

FWIW, next export doesn't work locally either when using next/image.

@cassidoo
Copy link

@amacneil next/image isn't meant to work with next export in general:
https://nextjs.org/docs/advanced-features/static-html-export#caveats

We do have to update that template, until then, this might be of interest for you:
https://github.com/cassidoo/next-netlify-starter

serhalp pushed a commit that referenced this issue Apr 5, 2024
Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

No branches or pull requests

3 participants