question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Unknown fragment, load fragment from node_modules?

See original GitHub issue

Version and Environment Details

Operation system: macOS

IDE name and version: Webstorm 2019.2

Plugin version: 2.2.0

image

I have a gatsby project where I get this warning “Unknown fragment GatsbyImageSharpFluid”. I do not have a definition for this fragment in my own source code, but the definition exists in package gatsby-transformer-sharp. It is a fragment that defines all the fields needed for other plugins to work.

Question: Can I configure something to make the plugin understand these fragments located in node_modules/gatsby-transformer-sharp/fragments.js? The fragments are exported from the package, I tried importing them but still not working.

Here is a snippet from node_modules/gatsby-transformer-sharp/fragments.js:

const GatsbyImageSharpFluid = _gatsby.graphql`
  fragment GatsbyImageSharpFluid on ImageSharpFluid {
    base64
    aspectRatio
    src
    srcSet
    sizes
  }
`;
/**
 * Traced SVG fluid images
 * @type {Fragment}
 */

exports.GatsbyImageSharpFluid = GatsbyImageSharpFluid;

I guess I could just copy paste the fragment definitions to my own source code, but is there a way to discover fragments in npm packages? 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

4reactions
jimkyndemeyercommented, Oct 24, 2019

Hi Thomas.

Thanks for using the plugin.

Please see https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/236 for how to make this work.

Best regards, Jim.

1reaction
jregistrcommented, May 19, 2020

Hey @jimkyndemeyer is this work-around included in the docs for js-graphql? Perhaps I skimmed too quick, but if it’s not, what do you think about adding a note? Particularly for those working with Gatsby.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Question] Unknown fragment, load fragment from ... - GitHub
I have a gatsby project where I get this warning "Unknown fragment GatsbyImageSharpFluid". I do not have a definition for this fragment in...
Read more >
[GraphQL error]: Message: Unknown fragment - Stack Overflow
Did I forgot something? ... I did this with Webpack Encore : .addLoader({ test: /\.(graphql|gql)$/, exclude: /node_modules/, loader: 'graphql-tag/ ...
Read more >
GraphQLError: Unknown fragment - Questions - Prisma 1 Forum
getting error about fragment { GraphQLError: Unknown fragment "FragmentName". api_1 | at Object.
Read more >
DocumentFragment - Web APIs | MDN
Chrome Edge DocumentFragment Full support. Chrome1. Toggle history Full support. Edge... DocumentFragment() constructor Full support. Chrome29. Toggle history Full support. Edge... append Full support. Chrome54. Toggle...
Read more >
Validation - GraphQL
Let's take a look at some invalid queries... A fragment cannot refer to itself or create a cycle, as this could result in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found