node.js - graphql-tag/index 没有导出成员 'gql'

标签 node.js angular graphql

我正在将我的 Angular 应用程序 REST 后端转换为 GraphQL。我正在尝试从 graphql-tag 导入 gql。我正在搜索和搜索,我的导入看起来和其他人一样...

import { Angular2Apollo } from 'angular2-apollo';
import { ApolloClient } from 'apollo-client';
import { gql } from 'graphql-tag';

但是gql有红色下划线表示没有找到。当我运行 ng serve 时,我在 cmder 中收到此错误...

.../node_modules/graphql-tag/index"' 没有导出成员 'gql'。)

我已经运行了很多很多 apollo 和 angular npm 安装,包括 npm install --save graphql-tag,尝试安装我缺少的任何东西,似乎我安装什么并不重要。

我做错了什么?

最佳答案

改为使用默认导出:

import gql from 'graphql-tag';

关于node.js - graphql-tag/index 没有导出成员 'gql',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46383110/

相关文章:

node.js - 可以更新 emacs rgrep 命令以在整个 Nodejs 项目中排除 `node_modules` 吗?

node.js - “需要登录”错误。使用 Google API 获取 oauth2 token 后如何登录

angular - 未捕获( promise ): Error: Export of name 'ngForm' not found

c# - ASP.NET 核心 SPA SSR : Use AntiForgery

go - HTTP请求: golang with graphQL?

angularjs - Firebase 拥有数千个 on() 事件监听器,设计良好

node.js - Redis docker-compose 与 Nodejs - 连接 ENOENT

javascript - Angular 5 : creating a parent component with an external template and overriding the inner part

vue.js - 具有多个别名和 Apollo (Vue.js) 的 GraphQL 查询

django - 在 graphene-django 中通过主键查找(带中继)