Consider decoupling CRA 2.0 from graphql-tag version
See original GitHub issue#3909 added support for importing *.graphql
files. This is only useful for GraphQL libraries that want to consume the AST from the graphql
package at the particular version bundled with CRA. This ties the upgrade of graphql and CRA together which seems limiting.
Relay (which doesn’t import GraphQL, but instead uses inline GraphQL) solves this in the next version by supporting babel-plugin-macros
which will look similar to:
import graphql from 'babel-plugin-relay/macro';
graphql`fragment Test on User { name }`
I’m not sure if loaders could be made ‘injectable’ in some way, but decoupling the projects might make upgrades easier going forward.
I want to add that keeping *.graphql
require support specific to Apollo doesn’t get in the way of Relay’s solution.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Compiling queries with Babel - Apollo GraphQL Docs
This approach will allow you to use the graphql-tag library as usual, and when processing the files with this babel plugin, the calls...
Read more >From a Single Repo, to Multi-Repos, to Monorepo, to Multi ...
The monorepo is a single repo that hosts the code for multiple projects. Since it hosts different packages together, we can version control...
Read more >graphql-tag - npm
A JavaScript template literal tag that parses GraphQL queries. Latest version: 2.12.6, last published: a year ago. Start using graphql-tag ...
Read more >PickBazar - React Ecommerce Template with ... - ThemeForest
Buy PickBazar - React Ecommerce Template with React Hooks, Next JS, GraphQL & REST API by redqteam on ThemeForest. Our super-fast E-commerce ...
Read more >Loading .graphql Files - Create React App
To load .gql and .graphql files, first install the graphql and ... use the non-macro version from graphql-tag package with the added benefit ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there something similar to
graphql-tag/loader
that’s implemented usingbabel-plugin-macro
? If so that might be a better way forward. That way the approach would be similar for Relay and Apollo and we wouldn’t be tying people to a specific version ofgraphql-tag
.Was the general consensus here that we revert #3909?