| 10 | ]; |
| 11 | |
| 12 | export const getImagesConfig = () => { |
| 13 | if (OPEN_NEXT_CLOUDFLARE) { |
| 14 | // If we're building for the Cloudflare deployment we want to use the custom cloudflare image loader |
| 15 | // |
| 16 | // Important: The custom loader ignores `remotePatterns` as those are configured as allowed source origins |
| 17 | // (https://developers.cloudflare.com/images/transform-images/sources/) |
| 18 | // in the Cloudflare dashboard itself instead (to the exact same values present in `remotePatterns` above). |
| 19 | // |
| 20 | return { |
| 21 | loader: 'custom', |
| 22 | loaderFile: './cloudflare/image-loader.ts', |
| 23 | }; |
| 24 | } |
| 25 | |
| 26 | return { |
| 27 | // We disable image optimisation during static export builds |
| 28 | unoptimized: ENABLE_STATIC_EXPORT, |
| 29 | // We add it to the remote pattern for the static images we use from multiple sources |
| 30 | // to be marked as safe sources (these come from Markdown files) |
| 31 | remotePatterns: remotePatterns.map(url => new URL(url)), |
| 32 | }; |
| 33 | }; |