@@ -4,6 +4,7 @@ import { join, relative, resolve } from 'pathe'
44import type { JSValue } from 'untyped'
55import { generateTypes , resolveSchema } from 'untyped'
66import escapeRE from 'escape-string-regexp'
7+ import { resolveModulePath } from 'exsolve'
78import { hash } from 'ohash'
89import { camelCase } from 'scule'
910import { filename , reverseResolveAlias } from 'pathe/utils'
@@ -13,6 +14,8 @@ import { annotatePlugins, checkForCircularDependencies } from './app.ts'
1314import { EXTENSION_RE } from './utils/index.ts'
1415import type { NuxtOptions , NuxtTemplate , NuxtTypeTemplate } from 'nuxt/schema'
1516
17+ const defuPath = resolveModulePath ( 'defu' , { try : true , from : import . meta. url } ) ?? 'defu'
18+
1619export const vueShim : NuxtTemplate = {
1720 filename : 'types/vue-shim.d.ts' ,
1821 getContents : ( { nuxt } ) => {
@@ -429,7 +432,7 @@ export const appConfigTemplate: NuxtTemplate = {
429432 getContents ( { app, nuxt } ) {
430433 return `
431434import { _replaceAppConfig } from '#app/config'
432- import { defuFn } from 'defu'
435+ import { defuFn } from ${ JSON . stringify ( defuPath ) }
433436
434437const inlineConfig = ${ JSON . stringify ( nuxt . options . appConfig , null , 2 ) }
435438
0 commit comments