image optimizations

This commit is contained in:
2025-06-12 22:44:51 +02:00
parent 49ff672904
commit 82b9d252aa
2 changed files with 30 additions and 0 deletions

View File

@@ -13,6 +13,18 @@ const config = {
images: {
loader: 'custom',
loaderFile: './image-loader.js',
// Set minimumCacheTTL to a high value to ensure Next.js doesn't invalidate the cache too early
minimumCacheTTL: 60 * 60 * 24 * 365, // 1 year in seconds
},
// Generate a unique build ID for each build if not provided by the environment
// This will be used for cache invalidation in the image loader
generateBuildId: async () => {
// Use existing build ID if available (e.g., from CI/CD)
if (process.env.BUILD_ID) {
return process.env.BUILD_ID
}
// Otherwise, use a timestamp
return `build-${Date.now()}`
},
}
const withNextIntl = createNextIntlPlugin()