mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What Follow up for #59852 , now you can use `next/og` if your nextjs app is marked as ESM with `"type": "module"` in package.json. ### How It's a bug in external handling, we shouldn't ESM import error for local requests. Previously you'll see the below error but the og import shouldn't be errored as it's not external package ``` Module not found: ESM packages (/.../app/opengraph-image.js) need to be imported. Use 'import' to reference the package instead https://nextjs.org/docs/messages/import-esm-externals ``` Closes NEXT-2147
24 lines
473 B
JavaScript
24 lines
473 B
JavaScript
import { ImageResponse } from 'next/og'
|
|
|
|
export default function OpenGraphImage() {
|
|
return new ImageResponse(
|
|
(
|
|
<div
|
|
style={{
|
|
width: 1200,
|
|
height: 630,
|
|
backgroundColor: '#000',
|
|
color: '#fff',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
flexDirection: 'column',
|
|
fontFamily: 'sans-serif',
|
|
}}
|
|
>
|
|
OG
|
|
</div>
|
|
)
|
|
)
|
|
}
|