Watch mode in GraphQL Code Generator is now consistent across file tracking, profiling, plugins and presets. Server Preset v0.19 builds on that with internal caching to make watch re-runs up to 80% faster, and Windows support is improved too.
Watch mode is consistent now
Watch mode is the recommended way to work with Codegen in managed workflows like Client Preset and Server Preset. But the base CLI’s watch-mode support wasn’t consistent across plugins and presets, and profiling didn’t work on every run.
Recent patch fixed reliability issues, and added improvements allow library authors more flexibility to control the output:
overwrite.updateExistingFilesandoverwrite.removeStaleFileslet a preset control whether its regenerated files are updated in place or removed as staleoverwriteset on a preset-basedgeneratesentry now workscontentComparisonlets plugins and presets choose disk vs. cache comparison when deciding whether to rewrite a file--profile --watchnow writes a trace after every rebuild, not just the initial run
Server Preset v0.19: up to 80% faster watch re-runs
With the watcher behaving predictably, we could make Server Preset lean on it. v0.19 uses the new watch capabilities and adds internal caching of its most expensive work: the check that compares resolver types against your mappers, and the schema parsing that every generates block used to repeat.
Measured on Hive Console’s codebase, on re-runs where schema types and mappers don’t change, generation time dropped by up to 80%.
Fixed Windows Support
We want Codegen to work in any environment seamlessly. Windows support has been lacking, mainly due to differences in how Windows handles file paths.
That’s fixed too:
- Watch mode’s ignore patterns now correctly use forward slashes, so generated output is ignored instead of being watched and re-triggering builds
- Loading a schema or documents from a
.js,.cjs, or.mjsfile no longer crashes with an ESM URL-scheme error
Upgrading
If watch mode still feels slow or wrong for you, run it with --profile and open an issue with the
trace on graphql-code-generator or
graphql-code-generator-plugins.
