繁体   English   中英

无法从apollo客户端导入createBatchingNetworkInterface

[英]cant import createBatchingNetworkInterface from apollo-client

我正在尝试将graphql与我的vue项目集成。 我正在按照以下说明进行操作: https : //github.com/Akryum/vue-apollo

我已经根据需要安装了npm'apollo-client',但是由于某种原因我无法导入'createBatchingNetworkInterface'。

这是我的main.js文件:

import Vue from 'vue'
import { ApolloClient, createBatchingNetworkInterface } from 'apollo-client'
import VueApollo from 'vue-apollo'
import App from './App'
import router from './router'

这是我的阿波罗客户端的index.d.ts文件:

export { print as printAST } from 'graphql/language/printer';
export { ObservableQuery, FetchMoreOptions, UpdateQueryOptions, ApolloCurrentResult } from './core/ObservableQuery';
export { WatchQueryOptions, MutationOptions, SubscriptionOptions, FetchPolicy, FetchMoreQueryOptions, SubscribeToMoreOptions, MutationUpdaterFn } from './core/watchQueryOptions';
export { NetworkStatus } from './core/networkStatus';
export * from './core/types';
export { ApolloError } from './errors/ApolloError';
import ApolloClient, { ApolloClientOptions } from './ApolloClient';
export { ApolloClientOptions };
export { ApolloClient };
export default ApolloClient;

我在这里看不到“ createBatchingNetworkInterface”所需的对象。

我不知道我在做什么错。

听起来您正在使用Apollo Client 2.0。应该降级到较旧的版本(1.9.3)才能继续使用网络接口,包括批处理接口。

客户端的最新版本改为使用链接。 如果您有兴趣,可以在此处查看升级指南。 您仍然可以使用apollo-link-batch-http在2.0版本中批量处理请求。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM