mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
fix: what happens if we use a dynamic import?
This commit is contained in:
@ -1,12 +1,8 @@
|
||||
import { ImageResponse } from 'next/og';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { allBlogPosts } from 'contentlayer/generated';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
const contentType = 'image/png';
|
||||
|
||||
const IMAGE_SIZE = {
|
||||
width: 1200,
|
||||
height: 630,
|
||||
@ -17,6 +13,8 @@ type BlogPostOpenGraphImageProps = {
|
||||
};
|
||||
|
||||
export async function GET(_request: Request, { params }: BlogPostOpenGraphImageProps) {
|
||||
const { allBlogPosts } = await import('contentlayer/generated');
|
||||
|
||||
const blogPost = allBlogPosts.find((post) => post._raw.flattenedPath === `blog/${params.post}`);
|
||||
|
||||
if (!blogPost) {
|
||||
|
||||
Reference in New Issue
Block a user