Skip to content

Commit

Permalink
chore: remove disableWriteToCacheDir and use isrFlushToDisk flag
Browse files Browse the repository at this point in the history
  • Loading branch information
isBatak committed Oct 1, 2024
1 parent 00855a3 commit bdd89af
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
16 changes: 0 additions & 16 deletions docs/02-app/02-api-reference/01-components/image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -778,22 +778,6 @@ module.exports = {
}
```

### `disableWriteToCacheDir`

Awoid writing optimized images to the cache directory.

This feature can be useful in scenarios where disk writes need to be avoided, such as in environments with limited disk space or read-only file systems.

The `x-nextjs-cache` response header will be `MISS` for every request.

```js filename="next.config.js"
module.exports = {
images: {
disableWriteToCacheDir: true,
},
}
```

## Animated Images

The default [loader](#loader) will automatically bypass Image Optimization for animated images and serve the image as-is.
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/server/image-optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export class ImageOptimizerCache {
revalidate?: number | false
}
) {
if (this.nextConfig.images.disableWriteToCacheDir) {
if (!this.nextConfig.experimental.isrFlushToDisk) {
return
}

Expand Down
4 changes: 0 additions & 4 deletions packages/next/src/shared/lib/image-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ export type ImageConfigComplete = {

/** @see [Unoptimized](https://nextjs.org/docs/api-reference/next/image#unoptimized) */
unoptimized: boolean

/** @see [Disable Write To Cache Dir](https://nextjs.org/docs/app/api-reference/components/image#disablewritetocachedir) */
disableWriteToCacheDir: boolean
}

export type ImageConfig = Partial<ImageConfigComplete>
Expand All @@ -124,5 +121,4 @@ export const imageConfigDefault: ImageConfigComplete = {
contentDispositionType: 'attachment',
remotePatterns: [],
unoptimized: false,
disableWriteToCacheDir: false,
}

0 comments on commit bdd89af

Please sign in to comment.