Parcel: Parcel 2: GraphQL transformer

Created on 12 Aug 2019  ·  2Comments  ·  Source: parcel-bundler/parcel

Create the @parcel/transformer-graphql package in packages/transforms/graphql. This package is a Parcel 2 transform plugin for GraphQL. It should be based on the GraphQLAsset from Parcel 1.

The @parcel/transformer-graphql package is responsible for the following things:

  • Collecting dependencies based on #import directives
  • Compiling with graphql-tag
  • Exposing the result as JavaScript

Currently, all of this happens inside the transformer, including recursively collecting dependencies. Ideally, the transformer would just expose the top-level imports as dependencies, and let Parcel traverse them. Finally, a packager should be able to combine them together. This will require some additional work, however, in order to allow inlining the results into a JS bundle. See also #3301 #3352.

✨ Parcel 2 🔌 Parcel 2 Plugins

Most helpful comment

i'm taking this. wish me luck guys 🔥

All 2 comments

i'm taking this. wish me luck guys 🔥

Hi. Would be nice to support named imports. I mean, to have multiple queries/mutations in only one graphql file, like:

query myQuery {
  name
  id
}

query myOtherQuery {
  desc
}
import { myQuery, myOtherQuery } from "./queries.graphql";
Was this page helpful?
0 / 5 - 0 ratings