fix: what happens if we use a dynamic import?
This commit is contained in:
@@ -1,12 +1,8 @@
|
|||||||
import { ImageResponse } from 'next/og';
|
import { ImageResponse } from 'next/og';
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
import { allBlogPosts } from 'contentlayer/generated';
|
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
|
|
||||||
const contentType = 'image/png';
|
|
||||||
|
|
||||||
const IMAGE_SIZE = {
|
const IMAGE_SIZE = {
|
||||||
width: 1200,
|
width: 1200,
|
||||||
height: 630,
|
height: 630,
|
||||||
@@ -17,6 +13,8 @@ type BlogPostOpenGraphImageProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function GET(_request: Request, { params }: 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}`);
|
const blogPost = allBlogPosts.find((post) => post._raw.flattenedPath === `blog/${params.post}`);
|
||||||
|
|
||||||
if (!blogPost) {
|
if (!blogPost) {
|
||||||
|
|||||||
Reference in New Issue
Block a user