Only statically optimize in production

This commit is contained in:
Sam Becker 2024-05-08 13:10:47 -05:00
parent cdb2ab5215
commit 1ffff2b6f6
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import { isNextImageReadyBasedOnPhotos } from '@/photo';
export let generateStaticParams:
(() => Promise<{ photoId: string }[]>) | undefined = undefined;
if (STATICALLY_OPTIMIZED_OG_IMAGES) {
if (STATICALLY_OPTIMIZED_OG_IMAGES && process.env.NODE_ENV === 'production') {
generateStaticParams = async () => {
const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT });
return photos.map(photoId => ({ photoId }));

View File

@ -18,7 +18,7 @@ import { GENERATE_STATIC_PARAMS_LIMIT, getPhotoIds } from '@/photo/db';
export let generateStaticParams:
(() => Promise<{ photoId: string }[]>) | undefined = undefined;
if (STATICALLY_OPTIMIZED_PAGES) {
if (STATICALLY_OPTIMIZED_PAGES && process.env.NODE_ENV === 'production') {
generateStaticParams = async () => {
const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT });
return photos.map(photoId => ({ photoId }));