Skip to content

Commit

Permalink
fix: missing imports in nitro runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Apr 10, 2023
1 parent fe90cb2 commit efaf544
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .playground/server/api/posts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import { getPosts } from '~/utils/api';
import { defineEventHandler } from 'h3'

const posts = [
{ title: `10 Tips for Writing Clean JavaScript Code`, slug: `10-tips-for-writing-clean-javascript-code` },
Expand Down
7 changes: 5 additions & 2 deletions src/runtime/nitro/plugins/prerender.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { appendHeader } from 'h3'
import { joinURL } from 'ufo'
import type { NitroAppPlugin } from 'nitropack'
import { extractOgImageOptions } from '../utils-pure'
import { useRuntimeConfig } from '#imports'

export default defineNitroPlugin((nitroApp) => {
const OgImagePrenderNitroPlugin: NitroAppPlugin = (nitroApp) => {
if (!process.env.prerender)
return

Expand All @@ -18,4 +19,6 @@ export default defineNitroPlugin((nitroApp) => {
if ((forcePrerender || options.static) && options.provider === 'satori')
appendHeader(event, 'x-nitro-prerender', joinURL(url, '/__og_image__/og.png'))
})
})
}

export default OgImagePrenderNitroPlugin

0 comments on commit efaf544

Please sign in to comment.