@@ -74,20 +74,6 @@ export default defineNuxtModule<ModuleOptions>({
7474 mode : 'client' ,
7575 order : 1 ,
7676 } ) ;
77-
78- // Add the sentry config file to the include array
79- nuxt . hook ( 'prepare:types' , options => {
80- const tsConfig = options . tsConfig as { include ?: string [ ] } ;
81-
82- if ( ! tsConfig . include ) {
83- tsConfig . include = [ ] ;
84- }
85-
86- // Add type references for useRuntimeConfig in root files for nuxt v4
87- // Should be relative to `root/.nuxt`
88- const relativePath = path . relative ( nuxt . options . buildDir , clientConfigFile ) ;
89- tsConfig . include . push ( relativePath ) ;
90- } ) ;
9177 }
9278
9379 const serverConfigFile = findDefaultSdkInitFile ( 'server' , nuxt ) ;
@@ -134,6 +120,26 @@ export default defineNuxtModule<ModuleOptions>({
134120 addDatabaseInstrumentation ( nuxt . options . nitro ) ;
135121 }
136122
123+ // Add the sentry config file to the include array
124+ nuxt . hook ( 'prepare:types' , options => {
125+ const tsConfig = options . tsConfig as { include ?: string [ ] } ;
126+
127+ if ( ! tsConfig . include ) {
128+ tsConfig . include = [ ] ;
129+ }
130+
131+ // Add type references for useRuntimeConfig in root files for nuxt v4
132+ // Should be relative to `root/.nuxt`
133+ if ( clientConfigFile ) {
134+ const relativePath = path . relative ( nuxt . options . buildDir , clientConfigFile ) ;
135+ tsConfig . include . push ( relativePath ) ;
136+ }
137+ if ( serverConfigFile ) {
138+ const relativePath = path . relative ( nuxt . options . buildDir , serverConfigFile ) ;
139+ tsConfig . include . push ( relativePath ) ;
140+ }
141+ } ) ;
142+
137143 nuxt . hooks . hook ( 'nitro:init' , nitro => {
138144 if ( nuxt . options ?. _prepare ) {
139145 return ;
0 commit comments