Add image base path configuration option (#23115)

I similarly [couldn't find this info](https://github.com/vercel/next.js/issues/19711#issuecomment-750414110) in the docs about configuring the image path when using an app `basePath`, so thought I'd add it.
This commit is contained in:
Shane Rogers 2021-03-16 10:13:24 -07:00 committed by GitHub
parent e36eb381da
commit 308c2beca2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,6 +94,18 @@ If you need a different provider, you can use the [`loader`](/docs/api-reference
> The `next/image` component's default loader is not supported when using [`next export`](/docs/advanced-features/static-html-export.md). However, other loader options will work.
### Base path
If you have deployed your application under a sub-path of a domain using the [`basePath`](/docs/api-reference/next.config.js/basepath.md) option, you will need to configure your images to reference this path.
```js
module.exports = {
images: {
path: `yourBasePath/_next/image`,
},
}
```
## Caching
The following describes the caching algorithm for the default [loader](#loader). For all other loaders, please refer to your cloud provider's documentation.