From 308c2beca2743fc99732be96eea4505234bb302c Mon Sep 17 00:00:00 2001 From: Shane Rogers Date: Tue, 16 Mar 2021 10:13:24 -0700 Subject: [PATCH] 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. --- docs/basic-features/image-optimization.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/basic-features/image-optimization.md b/docs/basic-features/image-optimization.md index 52a248861c..8fcb59173a 100644 --- a/docs/basic-features/image-optimization.md +++ b/docs/basic-features/image-optimization.md @@ -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. -- GitLab