Skip to content
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

chore(docs): update next-image-unconfigured-host.md #49175

Merged
merged 2 commits into from May 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions errors/next-image-unconfigured-host.md
Expand Up @@ -2,7 +2,7 @@

#### Why This Error Occurred

One of your pages that leverages the `next/image` component, passed a `src` value that uses a hostname in the URL that isn't defined in the `images.remotePatterns` or `images.domains` in `next.config.js`.
One of your pages that leverages the `next/image` component, passed a `src` value that uses a hostname in the URL that isn't defined in the `images.remotePatterns` in `next.config.js`.

#### Possible Ways to Fix It

Expand All @@ -15,7 +15,7 @@ module.exports = {
remotePatterns: [
{
protocol: 'https',
hostname: 'example.com',
hostname: 'assets.example.com',
port: '',
pathname: '/account123/**',
},
Expand All @@ -24,16 +24,17 @@ module.exports = {
}
```

If you are using an older version of Next.js prior to 12.3.0, you can use `images.domains` instead:
#### Fixing older versions of Next.js

```js
// next.config.js
module.exports = {
<details>
<summary>Using Next.js prior to 12.3.0?</summary>
<p>Older versions of Next.js can configure <code>images.domains</code> instead:</p>
<pre><code>module.exports = {
images: {
domains: ['assets.example.com'],
},
}
```
}</code></pre>
</details>

### Useful Links

Expand Down