Files
next.js/errors/export-image-api.mdx
T
Delba de OliveiraandGitHub 1e6d2044b4 docs: Refactor next and create-next-app CLI pages (#68899)
Closes: https://linear.app/vercel/issue/DOC-3249/cli-reference-pages

Updates the `next` and `create-next-app` CLI pages to follow the
reference page template. Moves these pages under "CLI" to match new IA.

Redirects: https://github.com/vercel/next.js/pull/68899
2024-08-22 10:05:00 -05:00

27 lines
1.3 KiB
Plaintext

---
title: Export with Image Optimization API
---
## Why This Error Occurred
You configured `output: 'export'` (or ran `next export`) while importing the `next/image` component using the default `loader` configuration.
However, the default `loader` relies on the Image Optimization API which is not available for exported applications.
This is because Next.js optimizes images on-demand, as users request them (not at build time).
## Possible Ways to Fix It
- Use [`next start`](/docs/pages/api-reference/cli/next#next-start-options) to run a server, which includes the Image Optimization API.
- Use any provider which supports Image Optimization (such as [Vercel](https://vercel.com)).
- [Configure `loader`](/docs/pages/api-reference/components/image#loader) in `next.config.js`.
- [Configure `unoptimized`](/docs/pages/api-reference/components/image#unoptimized) in `next.config.js`.
## Useful Links
- [Deployment Documentation](/docs/pages/building-your-application/deploying#managed-nextjs-with-vercel)
- [Image Optimization Documentation](/docs/pages/building-your-application/optimizing/images)
- [`output: 'export'` Documentation](/docs/pages/building-your-application/deploying/static-exports)
- [`next/image` Documentation](/docs/pages/api-reference/components/image)
- [Vercel Documentation](https://vercel.com/docs/concepts/next.js/image-optimization)