ardatan / graphql-import

Import & export definitions in GraphQL SDL
868 stars 56 forks source link

Unable to find any GraphQL type definitions for the following pointers (Meteor + Apollo) #566

Closed thearabbit closed 4 years ago

thearabbit commented 4 years ago

I base on Meteor Apollo Vue. My Code

/server/schema.graphql

type Query {
  hello: String
}
--------------------------------------
/server/resolvers.js

export default {
  Query: {
    hello: () => 'Hello Import Graphql!',
  },
}

Startup file

/server/main.js

import { ApolloServer, AuthenticationError } from 'apollo-server-express'
import { WebApp } from 'meteor/webapp'
import { getUser } from 'meteor/apollo'
import { mergeTypes, mergeResolvers } from 'merge-graphql-schemas'
import { importSchema } from 'graphql-import'

// Get schemas
import resolvers from './resolvers.js'
const typeDefs = importSchema('./schema.graphql')

// Create apollo server
const server = new ApolloServer({
  typeDefs: mergeTypes([typeDefs], { all: true }),
  resolvers: mergeResolvers([resolvers]),
  context: ...
})

server.applyMiddleware({
.....................

Get error

Unable to find any GraphQL type definitions for the following pointers

./schema.graphql

Please help me

ardatan commented 4 years ago

GraphQL Import doesn't support the environments using bundler under the hood. Meteor is one of them. So please try other solutions. https://forums.meteor.com/t/new-import-graphql-files-in-meteor/35304

thearabbit commented 4 years ago

Very thanks for your reply 👍