fix: stub schema imports in SSR to prevent OOM#124
Merged
Norbiros merged 1 commit intoNorbiros:mainfrom Jan 29, 2026
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
ba6f2df to
ca7b117
Compare
Contributor
Author
|
Did some profiling on this. The schema file isn't directly loaded during SSR - esbuild strips The real issue is memory accumulating across Nuxt's 3 build phases (client → server → nitro) without GC between them. GitHub Actions' ~2GB default isn't enough. Alternative approach: generate - filename: `types/${moduleName}/schemas/${kebabCase(name)}.ts`
+ filename: `types/${moduleName}/schemas/${kebabCase(name)}.d.ts`Vite/Rollup ignores Current PR works fine though, just documenting the alternative. |
ca7b117 to
501b657
Compare
Owner
|
Thanks for spotting this issue and opening the PR! I think the second solution you described (using |
501b657 to
9c604e5
Compare
Contributor
Author
|
Done! Switched to .d.ts approach - much cleaner 👍 |
Norbiros
approved these changes
Jan 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #87
Summary
Large OpenAPI schemas (200KB+ generated types) cause OOM during SSR build because Vite parses the type files even though they're only used for TypeScript checking. This adds a Vite plugin to stub schema imports during SSR.
StackBlitz
CLI Reproduction
Verify fix
The
-fixfolder uses pnpm patch to apply the fix locally.