2020-10-29 02:53:58 +01:00
|
|
|
# Invalid images config
|
|
|
|
|
|
|
|
#### Why This Error Occurred
|
|
|
|
|
|
|
|
In your `next.config.js` file you provided an invalid config for the `images` field.
|
|
|
|
|
|
|
|
#### Possible Ways to Fix It
|
|
|
|
|
|
|
|
Make sure your `images` field follows the allowed config shape and values:
|
|
|
|
|
|
|
|
```js
|
|
|
|
module.exports = {
|
|
|
|
images: {
|
|
|
|
// limit of 25 deviceSizes values
|
2020-11-03 03:12:46 +01:00
|
|
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
|
2020-10-29 02:53:58 +01:00
|
|
|
// limit of 25 imageSizes values
|
2020-11-03 03:12:46 +01:00
|
|
|
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
|
2020-10-29 02:53:58 +01:00
|
|
|
// limit of 50 domains values
|
|
|
|
domains: [],
|
2021-10-12 01:17:47 +02:00
|
|
|
// path prefix for Image Optimization API, useful with `loader`
|
2020-10-29 02:53:58 +01:00
|
|
|
path: '/_next/image',
|
2021-07-15 21:55:12 +02:00
|
|
|
// loader can be 'default', 'imgix', 'cloudinary', 'akamai', or 'custom'
|
2020-10-29 02:53:58 +01:00
|
|
|
loader: 'default',
|
2021-07-15 21:55:12 +02:00
|
|
|
// disable static imports for image files
|
|
|
|
disableStaticImages: false,
|
|
|
|
// minimumCacheTTL is in seconds, must be integer 0 or more
|
|
|
|
minimumCacheTTL: 60,
|
2021-10-12 01:17:47 +02:00
|
|
|
// ordered list of acceptable optimized image formats (mime types)
|
2021-10-22 23:08:03 +02:00
|
|
|
formats: ['image/webp'],
|
2022-02-16 20:28:22 +01:00
|
|
|
// enable dangerous use of SVG images
|
|
|
|
dangerouslyAllowSVG: false,
|
|
|
|
// set the Content-Security-Policy header
|
|
|
|
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
|
2020-10-29 02:53:58 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Useful Links
|
|
|
|
|
|
|
|
- [Image Optimization Documentation](https://nextjs.org/docs/basic-features/image-optimization)
|
2021-10-12 01:17:47 +02:00
|
|
|
- [`next/image` Documentation](https://nextjs.org/docs/api-reference/next/image)
|