-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: handle missing client.precomputed.mjs #33585
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
base: main
Are you sure you want to change the base?
fix: handle missing client.precomputed.mjs #33585
Conversation
|
|
@nuxt/kit
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
WalkthroughA Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
⏰ 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)
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 |
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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/nitro-server/src/runtime/utils/renderer/build-files.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Follow standard TypeScript conventions and best practices
Files:
packages/nitro-server/src/runtime/utils/renderer/build-files.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)
packages/nitro-server/src/runtime/utils/renderer/build-files.ts (1)
33-33: No issues found; type contract appears satisfied.The code at line 33 returns an empty object
{}as a fallback when the precomputed dependencies file fails to import. However, examination of the codebase reveals this is intentional and correct:
The function is explicitly type-cast as
Promise<PrecomputedData>, indicating the developer has considered the type contract.In development mode, precomputed is set to
undefinedrather than relying on the fallback, meaning the empty object return is only used in production when the file import actually fails—a rare edge case.The vite-node plugin explicitly exports
undefinedfor precomputed data in development, confirming thatPrecomputedDatacan accept empty or undefined values.Build-time generation of precomputed data occurs in webpack and Vite manifests via
precomputeDependencies(manifest), suggestingPrecomputedDatais a map/object structure where an empty object represents "no precomputed dependencies."Error handling includes a dev warning message, showing deliberate fallback design.
The pattern is sound: the empty object fallback satisfies the type contract as a valid representation of absent precomputed dependencies.
CodSpeed Performance ReportMerging #33585 will not alter performanceComparing Summary
|
🔗 Linked issue
Resolves #33579
📚 Description
This PR adds error handling for the missing
client.precomputed.mjsfile in the renderer utility to prevent build crashes when the file is not generated.Problem:
The
getPrecomputedDependencies()function currently importsclient.precomputed.mjswithout a.catch()handler. When this file doesn't exist (for reasons still being investigated), the import fails and causes the entire build to crash in production environments. Development builds work fine becauseprecomputedis set toundefinedwhenimport.meta.devis true.Solution:
Added a
.catch()handler togetPrecomputedDependencies()that:{}as a fallback when the file is missingThis graceful degradation approach ensures builds don't fail while we investigate the root cause of why
client.precomputed.mjsisn't being generated in certain scenarios.Testing:
client.precomputed.mjs