11import type { Head } from '@unhead/vue'
22import type { NuxtSSRContext } from 'nuxt/app'
33import type { OgImageOptions , OgImagePrebuilt , OgImageRuntimeConfig } from '../types'
4- import { useHead , useRuntimeConfig } from '#app'
54import { componentNames } from '#build/nuxt-og-image/components.mjs'
65import { resolveUnrefHeadInput } from '@unhead/vue'
76import { defu } from 'defu'
87import { stringify } from 'devalue'
8+ import { useHead , useRuntimeConfig } from 'nuxt/app'
99import { joinURL , withQuery } from 'ufo'
1010import { generateMeta , separateProps } from '../shared'
1111
@@ -85,7 +85,7 @@ export function resolveComponentName(component: OgImageOptions['component'], fal
8585
8686export function getOgImagePath ( pagePath : string , _options ?: Partial < OgImageOptions > ) {
8787 const baseURL = useRuntimeConfig ( ) . app . baseURL
88- const extension = _options ?. extension || useOgImageRuntimeConfig ( ) . defaults . extension
88+ const extension = _options ?. extension || useOgImageRuntimeConfig ( ) . defaults ? .extension || 'png'
8989 const path = joinURL ( '/' , baseURL , `__og-image__/${ import . meta. prerender ? 'static' : 'image' } ` , pagePath , `og.${ extension } ` )
9090 if ( Object . keys ( _options ?. _query || { } ) . length ) {
9191 return withQuery ( path , _options ! . _query ! )
@@ -96,6 +96,7 @@ export function getOgImagePath(pagePath: string, _options?: Partial<OgImageOptio
9696export function useOgImageRuntimeConfig ( ) {
9797 const c = useRuntimeConfig ( )
9898 return {
99+ defaults : { } ,
99100 ...( c [ 'nuxt-og-image' ] as Record < string , any > ) ,
100101 app : {
101102 baseURL : c . app . baseURL ,
0 commit comments