当我尝试导入'apollo-link-http'时,我在使用webpack捆绑文件时遇到错误。 Webpack正在抛出:
“找不到模块:错误:无法解析'导入' “/家/潘卡/ OpenWorld大会/播放 项目/管理门户网站/应用/前端/ node_modules /阿波罗链接-HTTP / lib目录” “
import { ApolloClient } from 'apollo-client';
import gql from 'graphql-tag';
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { ApolloProvider } from 'react-apollo';
const client = new ApolloClient({
link: new HttpLink({ uri: 'https://q80vw8qjp.lp.gql.zone/graphql'}),
cache: new InMemoryCache()
});
答案 0 :(得分:0)
尝试使用createHttpLink
代替或更新apollo-link-http
依赖项。
import { createHttpLink } from "apollo-link-http";
const client = new ApolloClient({
link: createHttpLink({ uri: https://q80vw8qjp.lp.gql.zone/graphql" });
cache: new InMemoryCache()
});