question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`next/export` will not work with `Image` when using `unoptimized`

See original GitHub issue

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

14.15.5

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

next export

Describe the Bug

When running next export using the Image from next/image, I set the unoptimized prop on Image, but still get the following error meaning I cannot export my app.

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`.

Also, using normal JSX img gives error saying next/image must be used instead.

Expected Behavior

next export using next/image will work when <Image unoptimized ... /> prop is added.

To Reproduce

Use Image with unoptimized set (to true) from next/image and run next build && next export

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
leerobcommented, Aug 12, 2021

Closing as this has been resolved with 11.1 as mentioned above (no longer on canary channel, but stable) 👍

2reactions
Cesarioocommented, Dec 27, 2021

Hi, it seems this issue is still ongoing for me and I have the latest version.

Error:Image Optimization using Next.js' default loader is not compatible withnext export. Possible solutions: - Use next startto run a server, which includes the Image Optimization API. - Use any provider which supports Image Optimization (like Vercel). - Configure a third-party loader innext.config.js. - Use the loaderprop fornext/image`.

How can I solve this issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Image Optimization using Next.js default loader is not ...
Error: Image Optimization using Next.js' default loader is not compatible with next export . Possible solutions: Use next start to run a server, ......
Read more >
export-image-api - Next.js
You are attempting to run next export while importing the next/image component using the default loader configuration. However, the default loader relies on...
Read more >
Deploy fails for next.js static export - Netlify Support Forums
I'm setting up a new Next.js project and can't get it to deploy for static export. I tried following the settings here: Framework ......
Read more >
Image Optimization Through Next.js - Topcoder
When a request is received that matches a cached but expired file, the cached file is removed before a new optimized picture is...
Read more >
Enable image optimization for static HTML export with Next.js
js does not support image optimization at build time and as there is no server, all of your images will be served unoptimized....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found