【问题标题】:Type-graphql with lerna --- Error: Cannot determine GraphQL output type for idType-graphql with lerna --- 错误:无法确定 id 的 GraphQL 输出类型
【发布时间】:2019-11-29 10:12:59
【问题描述】:

我最近从 yarn/workspaces 转到了 lerna/npm,在此过程中我发现了一个意想不到的问题。我知道得到:

Error: Cannot determine GraphQL output type for id 生成我的架构时

我正在使用 type-graphql 和 typeorm(一个很棒的组合)

我的包结构如下所示

/app
   /packages
       /utils (common functions)
       /data (my TypeORM entities, repos, factories, decorated with type-graphql)
       /server (my type-graphql server) deps on @app/data
       /server-test (tests my server) also deps on @app/data

在我执行以下操作后: 勒纳清洁 cd 应用程序/包/服务器 npm 运行开始

我现在收到Error: Cannot determine GraphQL output type for id

数据和服务器的package.json都引用"type-graphql": "^0.17.4"

====== 备注:https://github.com/19majkel94/type-graphql/issues/69

@19majkel94 声明如下:

最后一个错误Cannot determine GraphQL output type for id基本上 来自执行的 getGraphQLOutputType 和 convertTypeIfScalar 如果是 GraphQLScalarType 类型的实例。问题是分开 项目有单独的 node_modules 所以 GraphQLScalarType !== GraphQLScalarType。

根据我的经验,分离总是有太多问题 项目/模块的东西比这个的好处。我会 建议重组您的应用以使其不再需要。

所以对我来说放弃 lerna 和模块化似乎有点核心。我很想看看是否有办法使这项工作发挥作用。

【问题讨论】:

    标签: node.js graphql typeorm lerna typegraphql


    【解决方案1】:

    只需使用依赖提升,因此您的所有包都将使用根 node_modules 中的 graphql 模块。

    【讨论】:

      猜你喜欢
      • 2020-07-07
      • 2021-02-20
      • 2021-05-30
      • 2021-04-28
      • 2020-03-05
      • 2019-04-25
      • 2020-12-20
      • 2021-01-10
      • 2019-11-15
      相关资源
      最近更新 更多