Registry / devops / graphql-combine

graphql-combine

JSON →
library1.0.1jsnpmunverified

graphql-combine v1.0.1 is a utility for modularizing GraphQL schemas and resolvers by reading files from the filesystem. It uses glob patterns to collect schema.graphql and resolver.js files, merging them into a single typeDefs and resolvers object for Apollo Server or similar. Unlike graphql-tools' mergeFiles or manual concatenation, it provides a simple file-based convention. The package has had no updates since 2019 and relies on glob and merge-graphql-schemas. It is suitable for small to medium projects but lacks active maintenance.

npm install graphql-combine
INSTALL
IMPORT
SIG · GRAPHQL-COMBINE
G
graphql-combine
devopsjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

combine
import combine from 'graphql-combine'
const combine = require('graphql-combine')
Default import only; package is ESM-only (no CommonJS export).
typeof combine
import type { CombineOptions, CombineResult } from 'graphql-combine'
No separate type import available; types are not exported.
Package does not ship TypeScript definitions; types are inferred.
combine (nested)
import combine from 'graphql-combine'
import { combine } from 'graphql-combine'
combine is a default export, not named. Named import will result in undefined.

Combine schema.graphql and resolver.js files from multiple directories into one Apollo Server instance.

import { ApolloServer } from 'apollo-server'; import combine from 'graphql-combine'; import path from 'path'; const { typeDefs, resolvers } = combine({ typeDefs: path.join(__dirname, 'graphql/*/schema.graphql'), resolvers: path.join(__dirname, 'graphql/*/resolver.js') }); const server = new ApolloServer({ typeDefs, resolvers }); server.listen().then(({ url }) => console.log(`Server ready at ${url}`));
Debug
Known issues
gotchaThe package is ESM-only and will throw an error if used with require() in CommonJS environments.
fix
Use dynamic import() or switch to ESM project (type: 'module' in package.json).
affects: >=0.0.0
gotchaResolvers must export default a plain object; combine() does not handle named exports or resolver arrays.
fix
Ensure each resolver file has export default { ... }.
affects: >=0.0.0
gotchaCombined resolvers deeply merge; overlapping keys in resolvers from different files may cause unexpected overrides.
fix
Ensure resolver keys (e.g., Query, Mutation) are unique across files or wrap in separate namespaces.
affects: >=1.0.0
deprecatedThe package depends on merge-graphql-schemas (v1). This library is now deprecated and unmaintained.
fix
Consider migrating to graphql-tools' mergeResolvers and mergeTypeDefs from @graphql-tools/merge.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: combine is not a function
Importing combine as a named import instead of default import.
fix
Change import { combine } from 'graphql-combine' to import combine from 'graphql-combine'.
Error: Cannot find module 'graphql-combine'
Package not installed or path issue in ESM.
fix
Run npm install graphql-combine and ensure it is in node_modules.
SyntaxError: Unexpected token 'export'
Using require() on an ESM-only package in a CommonJS file.
fix
Use dynamic import() or set project to type: 'module' in package.json.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
globrequiredUsed to match resolver and typeDef file paths
merge-graphql-schemasrequiredUsed to merge the type definitions and resolvers
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
graphql-combine — npm install graphql-combine · libregistry