【问题标题】:How to change the folder to be imported in an angular app?如何更改要在 Angular 应用程序中导入的文件夹?
【发布时间】:2018-05-09 19:05:33
【问题描述】:

我正在使用 import {GraphQLSchema, GraphQLObjectType} from 'graphql'; 导入节点模块,但它引用了错误的文件夹。有什么方法可以引用节点模块“graphql”,而无需编写类似于我引用其他节点模块(如import { ApolloModule } from 'apollo-angular';)的整个路径?

这是我得到的错误:

'.../server/graphql/index"' has no exported member 'GraphQLObjectType'

我正在尝试引用节点模块,而不是我创建的文件夹。

这是我的文件结构的简化版本:

.
+-- client
|   +-- app.module.ts
+-- node_modules
+-- server
|   +-- graphql
|   |   +-- mutations
|   |   +-- queries
|   |   +-- types
|   |   +-- index.ts
|   |   +-- app.ts // my server file
+-- package.json
+-- .angular-cli.json

【问题讨论】:

    标签: node.js angular typescript import graphql


    【解决方案1】:

    可能有更好的答案,但最简单和最明显的答案是将您的 /server/graphql 文件夹重命名为 server/gql

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-28
      • 1970-01-01
      • 1970-01-01
      • 2012-11-15
      • 1970-01-01
      • 2018-07-19
      相关资源
      最近更新 更多