Build plugin that loads GraphQL files and makes them available through a virtual module import.
- ⚡️ Supports Vite, Webpack, Rspack, Vue CLI, Rollup, esbuild and more, powered by unplugin.
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'
@shellicar/core-config
- A library for securely handling sensitive configuration values like connection strings, URLs, and secrets.@shellicar/core-di
- A basic dependency injection library.@shellicar/core-foundation
- A comprehensive starter repository.
@shellicar/build-version
- Build plugin that calculates and exposes version information through a virtual module import.@shellicar/build-graphql
- Build plugin that loads GraphQL files and makes them available through a virtual module import.
@shellicar/svelte-adapter-azure-functions
- A SvelteKit adapter that builds your app into an Azure Function.
@shellicar/winston-azure-application-insights
- An Azure Application Insights transport for Winston logging library.@shellicar/pino-applicationinsights-transport
- Azure Application Insights transport for pino
pnpm add -D @shellicar/build-graphql
import graphqlPlugin from '@shellicar/build-graphql/esbuild';
import type { Options } from '@shellicar/build-graphql/types';
import { build } from 'esbuild';
const options: Options = {
globPattern: '../**/*.graphql',
debug: true,
};
await build({
entryPoints: ['src/main.ts'],
outdir: 'dist',
bundle: true,
platform: 'node',
target: 'node20',
tsconfig: 'tsconfig.json',
plugins: [graphqlPlugin(options)],
});
import typedefs from '@shellicar/build-graphql/typedefs'
See examples for full working implementations.
See types.ts for detailed options documentation.