Import from generated/prisma.graphql does not work

prisma

#1

Hi All! Have a quick question.

I have two projects

  1. graphql-yoga + Prisma
  2. apollo-server + Prisma

both projects have schema.graphql file and it has the following line
# import * from './generated/prisma.graphql'
It works fine with the first project but for the second one it does not.
As i understand Prisma provides me with # import... ability. Am i right? I think apollo-server can’t be a reason.
names and paths are correct as i can see. I can’t get what is going wrong. Any ideas?


#2

OK, i’ve got the reason.

As i understand Prisma provides me with # import... ability. Am i right?

It’s provided by graphql-yoga not prisma.

I think it apollo-server can’t be a reason

It is the reason. It’s exactly why apollo-server cannot do it.

I just changed my creating schema logic

const { importSchema } = require('graphql-import');

const typeDefsFile = importSchema(__dirname.concat('/graphql/schema.graphql'));
const typeDefs = gql(typeDefsFile);

const server = new ApolloServer({
  typeDefs,
  // another config props...
});