我做了这个示例:https ://github.com/Akryum/vueconf-2017-demo
结果,我的项目中有相同的文件:https ://github.com/Akryum/vueconf-2017-demo/blob/master/src/apollo-client.js
这是我的应用程序中使用的代码:
import { ApolloClient, createNetworkInterface } from 'apollo-client'
const apolloClient = new ApolloClient({
networkInterface: createNetworkInterface({
uri: 'http://localhost:3000/graphql',
transportBatching: true,
}),
connectToDevTools: true,
})
export default apolloClient
结果,我在控制台收到此错误(警告):
warning in ./src/apollo/client.js
15:23-45 "export 'createNetworkInterface' was not found in 'apollo-client'
这是来自浏览器控制台:
TypeError: Object(__WEBPACK_IMPORTED_MODULE_0_apollo_client__["createNetworkInterface"]) is not a function. (In 'Object(__WEBPACK_IMPORTED_MODULE_0_apollo_client__["createNetworkInterface"])({
uri: 'http://localhost:3000/graphql',
transportBatching: true
})', 'Object(__WEBPACK_IMPORTED_MODULE_0_apollo_client__["createNetworkInterface"])' is an instance of Object)
问题是什么?