Build plugin that loads GraphQL files and makes them available through a virtual module import.
npm i --save @shellicar/build-graphql
pnpm add @shellicar/build-graphql
// build.ts
import GraphQLPlugin from '@shellicar/build-graphql/esbuild'
await build({
// other options
plugins: [
GraphQLPlugin({
globPattern: 'src/**/*.graphql'
})
]
})
// vite.config.ts
import GraphQLPlugin from '@shellicar/build-graphql/vite'
export default defineConfig({
// other options
plugins: [
GraphQLPlugin({
globPattern: 'src/**/*.graphql'
})
],
});
// main.ts
import typedefs from '@shellicar/build-graphql/typedefs'
For full documentation, visit here.