My file structure is as below
# for frontend
def MyWeb.Graphql.Types do
import_types(ModuleA.Graphql.Types)
import_types(ModuleB.Graphql.Types)
...
import_types(ModuleZ.Graphql.Types)
end
def MyWeb.Graphql.Schema do
import_types(MyWeb.Graphql.Types)
import_types(Absinthe.Plug.Types)
end
# for admin panel
def MyWeb.Admin.Graphql.Types do
import_types(ModuleAlpha.Graphql.Types)
import_types(ModuleBeta.Graphql.Types)
...
import_types(ModuleZeta.Graphql.Types)
end
def MyWeb.Admin.Graphql.Schema do
import_types(MyWeb.Admin.Graphql.Types)
import_types(Absinthe.Plug.Types)
end
With the dependencies I introduced through import_types
, running mix xref graph --label compile --sink lib/my/foo/bar.ex
would show me a lot of deps
and making a change to the code base would take 20s to recompile.
lib/my_web/admin/graphql/types.ex
├── lib/my/a/graphql/admin_types.ex (compile)
├── lib/my/b/graphql/admin_types.ex (compile)
├── lib/my/models/c/graphql/admin_types.ex (compile)
├── lib/my/models/d/graphql/admin_types.ex (compile)
├── lib/my/models/e/graphql/admin_types.ex (compile)
├── lib/my/models/f/graphql/admin_types.ex (compile)
├── lib/my/models/g/graphql/admin_types.ex (compile)
Am I the only one facing this problem? I couldn’t find any discussions on this topic on Google which was a bit alarming I have done something wrong.