Make it work on edge functions

Author: ramielCreated Apr 3, 2023Updated Jun 26, 2026
LabelsEnhancement :new:Community :family_man_girl:

Is your feature request related to a problem? Please describe. typegraphql cannot work, at the moment, on edge function engines, like the one of cloudflare workers or vercel@edge. The only reason why it cannot work is because the "emit schema to file" feature relies on path and fs libraries. No other part of the code is problematic. This is a little shame because a secondary feature is preventing it to work.

Describe the solution you'd like Since the only feature is emitSchemaFile we could isolate this functionality into a different package (e.g. typegraphql-schema-emit or as submodule typegraphql/schema-emit) and have it as optional peer dependency, so that, when the user want to use the non programmatic way of emitting schema they need that dependency. As well, when they want to use the programmatic way, they need to referthat dependency directly.

Describe alternatives you've considered It's not easy to isolate some parts of a library. Maybe tree shaking can help but it's not easy.

Source: MichalLytek/type-graphql