Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prisma-labs/graphql-import-loader
Webpack loader for `graphql-import`
https://github.com/prisma-labs/graphql-import-loader
graphql graphql-import webpack webpack-loader
Last synced: about 1 month ago
JSON representation
Webpack loader for `graphql-import`
- Host: GitHub
- URL: https://github.com/prisma-labs/graphql-import-loader
- Owner: prisma-labs
- License: mit
- Created: 2018-03-01T12:20:32.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-03T19:25:59.000Z (about 5 years ago)
- Last Synced: 2024-10-28T18:56:21.859Z (about 1 month ago)
- Topics: graphql, graphql-import, webpack, webpack-loader
- Language: TypeScript
- Size: 11.7 KB
- Stars: 83
- Watchers: 6
- Forks: 13
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - graphql-import-loader - Webpack loader for `graphql-import` (TypeScript)
README
# graphql-import-loader
[![CircleCI](https://circleci.com/gh/graphcool/graphql-import-loader.svg?style=shield)](https://circleci.com/gh/graphcool/graphql-import-loader) [![npm version](https://badge.fury.io/js/graphql-import-loader.svg)](https://badge.fury.io/js/graphql-import-loader)
Webpack loader for [`graphql-import`](https://github.com/graphcool/graphql-import)
## Install
```console
yarn add --dev graphql-import-loader
```## Usage
Resolve GraphQL file import statements as a string. See the tests for more details
```graphql
# import { A } from 'src/schema/a.graphql'
# import { B } from 'src/schema/b.graphql'
# import { C, D } from 'src/schema/cd.graphql'type Complex {
id: ID!
a: A!
b: B!
c: C!
d: D!
}
``````js
import typeDefs from './schema.graphql'
``````js
// webpack.config.jsmodule.exports = {
module: {
rules: [
{
exclude: /node_modules/,
test: /\.graphql$/,
use: [{ loader: 'graphql-import-loader' }]
}
]
}
}
```## Examples
Simple Server:
```ts
import { GraphQLServer } from 'graphql-yoga'
import resolvers from './resolvers'
import typeDefs from './schema.graphql'const server = new GraphQLServer({ typeDefs, resolvers })
server.start(() => console.log('Server running on :4000'))
```Advanced:
[serverless-prisma](https://github.com/jgeschwendt/serverless-prisma): Serverless starter kit using Prisma (early-stages)