Skip to content
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

fix: auto generate types faster and more reliably to avoid issues when spawning processes #11315

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

r1tsuu
Copy link
Member

@r1tsuu r1tsuu commented Feb 21, 2025

Fixes #11276

Previously, to auto generate types on HMR and startup we spawned a child process with the payload generate:types command.
This, potentially can cause some issues in monorepos (our Astro and Remix examples, as described in #11276) and whenever payload config path cannot be determined (as it's necessary for payload.bin) It's also faster to execute generateTypes directly.

Nevertheless, it was a necessary change because of a turbopack issue #6714 vercel/next.js#66723

The issue now looks resolved, I tested against the latest next.js canary with a packed payload version from this PR and types auto-generation works correctly using pnpm dev --turbo.

Other changes were necessary to pass integration and unit tests Apparently, as jest isn't executed in a proper ESM environment, it requires to use --experimental-vm-modules to be able to load json-schema-to-typescript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Payload using 100% CPU usage in idle
2 participants