// Importing the CodegenConfig type from '@graphql-codegen/cli' package
import type { CodegenConfig } from '@graphql-codegen/cli';
// Defining a configuration object for GraphQL code generator
const config: CodegenConfig = {
// Array of schema configurations
schema: [
{
// URL of the GraphQL endpoint
//playground url : https://api.travelgatex.com/playground
'https://api.travelgatex.com/': {
// method: 'GET',
// Headers to be sent with each request to this endpoint
headers: {
// Authorization header with API key
Authorization: 'Apikey 8626355',
},
},
},
],
hooks: {
afterAllFileWrite: ['eslint --fix'],
},
// Path to the directory containing GraphQL documents (queries, mutations, etc.)
documents: './src/*.graphql',
// Configuration for generated files
generates: {
// Path and filename for the output file
'./src/graphql-operations.ts': {
// List of plugins to use during generation
plugins: ['typescript', 'typescript-operations', 'typed-document-node'],
},
},
};
// Exporting the configuration object as default export
export default config;
Which packages are impacted by your issue?
@graphql-codegen/cli, @graphql-codegen/client-preset
Describe the bug
While Loading the Schema by running
graphql-codegen
commend i'm getting ✖ Syntax Error: Unexpected Name "import".Your Example Website or App
https://stackblitz.com/edit/nestjs-typescript-starter
Steps to Reproduce the Bug or Issue
Simply open the code, and the code will run automatically.
Expected behavior
as i dev i expect the graphql-codegen will execute successfully
Platform
graphql
version: [16.7.1]@graphql-codegen/cli | client-preset
version(s): [4.0.1]Codegen Config File
Additional context
No response