Skip to main content

Migration from GraphQL Import

GraphQL Import was an NPM package that allows you import and export definitions using #import syntax in .graphql files. So this package has been moved under GraphQL Tools monorepo. It is really easy to migrate. You need two different packages @graphql-tools/load and @graphql-tools/graphql-file-loader.


import { importSchema } from 'graphql-import';
import { makeExecutableSchema } from 'graphql-tools';
import { join } from 'path';
const typeDefs = importSchema(join(__dirname, 'schema.graphql'));
const resolvers = {
Query: {/**...*/}
const schema = makeExecutableSchema({ typeDefs, resolvers });


import { loadSchemaSync } from '@graphql-tools/load';
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
import { addResolversToSchema } from '@graphql-tools/schema';
import { join } from 'path';
const schema = loadSchemaSync(join(__dirname, 'schema.graphql'), { loaders: [new GraphQLFileLoader()] });
const resolvers = { Query: {/**...*/} };
const schemaWithResolvers = addResolversToSchema({

You can learn more about those new packages in Schema Loading section.