Skip to content

next export with next/image + this plugin #645

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
haf opened this issue Sep 10, 2021 · 4 comments
Closed

next export with next/image + this plugin #645

haf opened this issue Sep 10, 2021 · 4 comments

Comments

@haf
Copy link

haf commented Sep 10, 2021

Describe the bug

When using this plugin, running next export doesn't work, because there's no custom configuration in next.config.js targeting the function that this plugin installs in the site during build time.

Error: Image Optimization using Next.js' default loader is not compatible with `next export`.
  Possible solutions:
    - Use `next start` to run a server, which includes the Image Optimization API.
    - Use any provider which supports Image Optimization (like Vercel).
    - Configure a third-party loader in `next.config.js`.
    - Use the `loader` prop for `next/image`.
  Read more: https://nextjs.org/docs/messages/export-image-api
    at /Users/h/dev/haf/cool-comet/node_modules/next/dist/export/index.js:257:23
    at async Span.traceAsyncFn (/Users/h/dev/haf/cool-comet/node_modules/next/dist/telemetry/trace/trace.js:60:20)

I'm not sure what this really means. Since the function is deployed after building, I'd need to customise the loader to call the function; but I don't know the URL for it at build time, and there's no function deployed until after the build succeeds.

References:

Maybe I'm just asking for help, maybe it's a bug. I don't really know :/

To Reproduce
Steps to reproduce the behavior:

  1. Use next/image on any stackbit.com site or simply try to use next export with next/image
  2. See error

Expected behavior
I expect this plugin, or to be able to provide a custom url to where this plugin deploys its function, to support next export.

Versions

  • Next.js: 11.1.2
  • plugin (if installed at fixed version): 3.9.0
@ascorbic
Copy link
Contributor

Hi. Currently this plugin doesn't support next export, so you would need another way to handle the images. One option could be to manually copy the function to your own site, and add a custom loader to point to it. This is the function, and you could put that in your /netlify/functions folder. The API would be /.netlify/functions/yourfunctionname/yourimage.jpg/<yourwidth>/<yourquality>.

@pejeio
Copy link

pejeio commented Sep 30, 2021

Same issue here..

@ascorbic
Copy link
Contributor

ascorbic commented Nov 2, 2021

I'm going to close this because next export doesn't support the default loader, and isn't supported in the plugin either. I would suggest opening a feature request against https://www.github.com/netlify/ipx to add docs for using it as a custom loader for next export sites

@ascorbic ascorbic closed this as completed Nov 2, 2021
@ernie-blockswap
Copy link

Hi. Currently this plugin doesn't support next export, so you would need another way to handle the images. One option could be to manually copy the function to your own site, and add a custom loader to point to it. This is the function, and you could put that in your /netlify/functions folder. The API would be /.netlify/functions/yourfunctionname/yourimage.jpg/<yourwidth>/<yourquality>.

Sorry, but the link is broken. Could you please point me to a correct one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants