简体   繁体   English

无法从 apollo-server-express 导入 SchemaDirectiveVisitor

[英]Unable to import SchemaDirectiveVisitor from apollo-server-express

const { SchemaDirectiveVisitor } = require('apollo-server-express');

class ReplaceDirective extends SchemaDirectiveVisitor {
visitFieldDefinition(field) {
    const { replacement } = this.args;
    field.resolve = () => {
        return replacement
    }
}
}

module.exports = Object.freeze({ ReplaceDirective })

The Error I am getting is following TypeError: Class extends value undefined is not a constructor or null我得到的错误是 TypeError: Class extends value undefined is not a constructor or null

They got rid of the SchemaDirectiveVisitor and added two new functions to simplify: mapSchema and getDirectives.他们摆脱了 SchemaDirectiveVisitor 并添加了两个新函数来简化:mapSchema 和 getDirectives。

Source: https://www.the-guild.dev/blog/graphql-tools-v6 Then scroll to the following title.来源: https ://www.the-guild.dev/blog/graphql-tools-v6 然后滚动到以下标题。 Modify Schemas with Directives使用指令修改模式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 阿波罗服务器快递 CORS 问题 - apollo-server-express CORS issue 使用ApolloClient和Apollo-Server-Express进行GraphQL错误处理 - GraphQL Error Handling with ApolloClient and Apollo-Server-Express Apollo-server-express 返回“无法获取 /”而不是 Graphql 游乐场 - Apollo-server-express returning “cannot Get /” instead of the Graphql playground res.session 未定义 graphql apollo-server-express - res.session undefined graphql apollo-server-express apollo-server 和 apollo-server-express 在 GraphQL 端点上的区别 - Difference on GraphQL endpoint between apollo-server and apollo-server-express 无法读取未定义的属性(读取“findOne”)| 阿波罗服务器快递 | 续集 - Cannot read properties of undefined (reading 'findOne') | apollo-server-express | sequelize 扩展SchemaDirectiveVisitor以在NodeJS中使用Apollo服务器架构指令 - Extend SchemaDirectiveVisitor To Use Apollo Server Schema Directives in NodeJS cors 错误:没有“Access-Control-Allow-Origin”标头 apollo-server-express - cors error: No 'Access-Control-Allow-Origin' header apollo-server-express 来自 apollo-server-lambda 上下文的 `express` object 未定义 - `express` object from apollo-server-lambda context is undefined 订阅不适用于 Apollo Server Express - Subscriptions not working on Apollo Server Express
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM