-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix(nitro): include layer server directories in tsconfig.server.json #33489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
Walkthrough
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
CodSpeed Performance ReportMerging #33489 will not alter performanceComparing Summary
|
|
the description of this PR does not match its contents am I missing something? |
Fixes #33477 Layer server directories were not being included in the generated .nuxt/tsconfig.server.json, causing TypeScript errors in IDEs for server files within layers (e.g., 'Cannot find name defineNitroPlugin'). This change adds layer server paths to the TypeScript configuration, mirroring how Nitro already handles layer server directories in its scanDirs configuration. - Add layer server paths to tsconfig include array - Ensures IDE TypeScript support for layer server files - Removes need for manual workaround in nuxt.config.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/nitro-server/src/index.ts (1)
217-217: tsconfig.server.json: Windows compatibility OK, add explicit node_modules exclusion
joinfrom pathe +relativeWithDotemit POSIX paths, so the**/*glob works on Windows.- Specifying
excludeoverrides TS’s defaultnode_modulesfilter—nestednode_modulesunder layer server dirs would be picked up if present. Consider adding a generic**/node_modules/**exclusion (e.g. viarelativeWithDot(nuxt.options.buildDir, join(dirs.server, 'node_modules', '**/*'))).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
packages/nitro-server/src/index.ts(1 hunks)playground/layers/test-layer/nuxt.config.ts(1 hunks)playground/layers/test-layer/server/plugins/test.ts(1 hunks)playground/nuxt.config.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- playground/layers/test-layer/nuxt.config.ts
- playground/layers/test-layer/server/plugins/test.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow standard TypeScript conventions and best practices
Files:
playground/nuxt.config.tspackages/nitro-server/src/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build
- GitHub Check: code
🔇 Additional comments (1)
playground/nuxt.config.ts (1)
2-4: LGTM!The test layer extension is correctly configured to verify the TypeScript configuration fix for layer server files.
|
Hi @danielroe, thanks for the earlier feedback! Apologies for the confusion in the previous commit. I’ve now updated the PR to include the actual fix in The playground layer files in The PR title and description now match the changes. Please let me know if any further adjustments are needed. |
|
would you revert the changes to the playground and write an assertion in one of the other test suites that has layers? 🙏 we could do basic.test.ts but I think there's a fixture which is more unjt-test level and I'd prefer that if possible. |
|
do you need any help? |
Fixes an issue where server files inside Nuxt layer directories (e.g., layers/*/server/**) were not automatically included in .nuxt/tsconfig.server.json, causing IDEs to fail type resolution for Nitro types like defineNitroPlugin. Changes: - Add layer server directories to Nitro TypeScript config include - Add test to verify layer server paths are included in tsconfig Closes nuxt#33489
|
Thank you! I’ve submitted PR #33510 (fix(nitro): include layer server directories in tsconfig.server.json). Happy to update it if you have any feedback. 🙌 |
Fixes #33477
In Nuxt 4.1.3, server files inside layer directories (e.g.
layers/*/server/**) were not being included in the generated.nuxt/tsconfig.server.json. This caused TypeScript errors in IDEs such as WebStorm (e.g.Cannot find name 'defineNitroPlugin'), even though the application ran correctly.This change updates the TypeScript configuration generation to automatically include all layer server directories, matching how Nitro already includes them in its
scanDirsconfiguration.Changes
includearray in.nuxt/tsconfig.server.jsonnitro.typescript.tsConfig.includeLinked issue
Fixes #33477
Notes
This aligns the handling of layer server directories with the main server directory, improving TypeScript developer experience without affecting runtime behavior.