0.0.4 • Published 6 months ago
@o7/vite-plugin-gql v0.0.4
Usage
// vite.config.js
import { defineConfig } from 'vite';
import gqlPlugin from '@o7/vite-plugin-gql';
export default defineConfig({
plugins: [
gqlPlugin({
url: 'https://example.com/graphql', // Your endpoint
headers: {
'Public-Token': 'abc123',
},
outFile: 'src/gql.d.ts',
}),
],
});
// src/index.ts
import gql from '$gql';
const data = await gql(/* GraphQL */ `
query {
object {
id
name
}
}
`);
// ^ Automatically inferred as { object: { id: string, name: string } }
Changelog
0.0.4
- removed default Decimal scalar
0.0.3
- removed default overload to fix typescript issues
0.0.2
- Fix input object handling
- Handle nullable types properly
0.0.1
- Initial release