Meteor does not play nice with .graphql files

We are using .graphql files to define a GraphQL schema. Those files are imported in a single index.js file using this Babel plugin: https://github.com/credcollective/babel-plugin-inline-import

The problem is that changes to the .graphql files don’t cause a restart, and even worse, when you check out a branch that has changes and start the app, it continues to use some cached files rather than the updated ones.

This results in errors like “___ is defined in resolvers but not in schema”

A meteor reset fixes it but is overkill. I’m not sure exactly where the cache is to more granularly delete that. It also works to make a non-whitespace change to the index.js file where the .graphql files are imported, but that is only a temporary fix. The error comes back if you revert that change.

This general problem is described in the “Caveats” section of the Babel plugin readme here: https://github.com/credcollective/babel-plugin-inline-import#caveats

But while BABEL_DISABLE_CACHE=1 works in a Node app, it doesn’t work in a Meteor app.

Anybody got a solution? Either a way for Meteor Babel to respect BABEL_DISABLE_CACHE=1 or a cleaner way to bust that cache.

1 Like

Check out these packages:
https://atmospherejs.com/orionsoft/graphql-compiler
https://atmospherejs.com/swydo/graphql

2 Likes

Thanks! orionsoft:graphql-compiler solved the problem. I would be nice if it didn’t require an additional Meteor package dependency, but works for now.

2 Likes

I am having the same issue. It doesn’t matter if I add either of those packages. My graphql files seem to be cached. Editing the js file that imports them sometimes will trigger the schema to be rebuilt.
Is there some way to force meteor to not cache graphql files if these packages aren’t working for me? This has been an issue since 1.6 for me and still on 1.8. I think i had it fixed at some point but I cant remember what was done differently.