Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use intellisense for server GQL while using generated localSchemaFile #117

Open
addiebarron opened this issue Oct 18, 2023 · 1 comment

Comments

@addiebarron
Copy link

addiebarron commented Oct 18, 2023

We have a generated schema file, schema.graphql. The file is generated by merging definitions from gql tags throughout our typescript backend.

We would like to get intellisense, autocomplete, etc. within those gql tags in our typescript backend files. In order to do that, it seems like we must include those files in our apollo.config.js via the includes key. But if we do this, the language server repeatedly crashes with a ton of errors along these lines: Type "XXX" already exists in the schema. It cannot also be defined.... For reference, here is our config, roughly:

module.exports = {
  client: {
    service: {
      name: "service-name",
      localSchemaFile: "./generated/schema.graphql",
    },
    includes: [
      "./src/client/**/*.{ts,tsx,js,jsx}",
      // If we include these server files, everything breaks
      "./src/server/**/*.{ts,tsx,js,jsx}"
    ],
    excludes: [
      "**/*tests.{ts,tsx,js,jsx}",
      "*.graphql",
    ],
  },
};

Ideally we would either 1) have the schema parsed from our ts files without loading the generated schema, or 2) be able to use intellisense for our ts files without merging them into the loaded schema.

@addiebarron addiebarron changed the title Cannot enable intellisense for server-side GQL while using localSchemaFile Cannot use intellisense for server GQL while using generated localSchemaFile Oct 18, 2023
@phryneas
Copy link
Member

Hi there, sorry for the late response!

In your case, I would create two apollo.config.js files in the client and server folder respectively - the extension will detect those and apply different rules to those folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants