luckycatfactory / esbuild-graphql-loader

An esbuild Plugin Allowing for GraphQL File imports
44 stars 8 forks source link

Fragments in same file are not included in bundle #26

Open NicolaiSchmid opened 3 years ago

NicolaiSchmid commented 3 years ago
fragment RecipientFragment on Address {
  address
}

fragment ListMessageFragment on ListMessage {
  recipient {
     ...RecipientFragment
  }
}

fragment MessageFragment on MailboxMessagesConnection {
  nodes {
    ...ListMessageFragment
  }
}
build({
  entryPoints: ["src/index.js"],
  outdir: "build/t",
  sourcemap: true,
  bundle: true,
  target: ["firefox91", "chrome93"],
  loader: { ".js": "jsx", ".svg": "text" },
  plugins: [
    graphqlLoaderPlugin.default({}),
  ],
}).catch(() => process.exit(1));

While the files get bundled and graphql-taged correctly, the fragments are just not included... I'm not sure where to look, to narrow down this issue. Any help is greatly appreciated!

{
    "@luckycatfactory/esbuild-graphql-loader": "^3.7.0",
    "esbuild": "^0.13.12",
    "graphql-tag": "^2.12.5",
}
louisscruz commented 2 years ago

Sorry for delay here. Just seeing now.

I’ll take a look at this in the next few days and get back to you when I find a path forward.

NicolaiSchmid commented 2 years ago

Any leads so far?

NicolaiSchmid commented 2 years ago

It seems to be happening only on nested Fragment, similar to this test case. While the first fragment is imported, the child fragment dependencies are not included

donkeyDau commented 2 years ago

Any progress on that? Would love to use esbuild but failing on this as well.

juanpprieto commented 1 year ago

+1 nested fragments and fragment+query in the same file are not being substituted