Skip to content

Commit 431cf60

Browse files
fix(nuxt): include sentry.config.server.ts in nuxt app types
1 parent 3e6d0dd commit 431cf60

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/nuxt/src/module.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ export default defineNuxtModule<ModuleOptions>({
9999
src: moduleDirResolver.resolve('./runtime/plugins/route-detector.server'),
100100
mode: 'server',
101101
});
102+
103+
// Add the sentry config file to the include array
104+
nuxt.hook('prepare:types', options => {
105+
const tsConfig = options.tsConfig as { include?: string[] };
106+
107+
if (!tsConfig.include) {
108+
tsConfig.include = [];
109+
}
110+
111+
// Add type references for useRuntimeConfig in root files for nuxt v4
112+
// Should be relative to `root/.nuxt`
113+
const relativePath = path.relative(nuxt.options.buildDir, serverConfigFile);
114+
tsConfig.include.push(relativePath);
115+
});
102116
}
103117

104118
if (clientConfigFile || serverConfigFile) {

0 commit comments

Comments
 (0)