Closed xomaczar closed 2 years ago
Hi there. Glimmer Apollo does not include any file processing like importing .graphql
files.
You can take a look at using Webpack with Embroider as that is the best moving forward option. But you can also use broccoli-graphql-filter
with an in-repo addon.
Here is the code for that:
'use strict';
module.exports = {
name: require('./package').name,
isDevelopingAddon() {
return true;
},
setupPreprocessorRegistry(type, registry) {
if (type === 'parent') {
registry.add('js', {
name: require('./package').name,
ext: 'graphql',
toTree(tree) {
const GraphQLFilter = require('broccoli-graphql-filter');
return new GraphQLFilter(tree, {
keepExtension: true
});
}
});
}
}
};
{
"name": "graphql-loader",
"dependencies": {
"broccoli-graphql-filter": "*"
},
"keywords": [
"ember-addon"
],
"ember-addon": {
"before": [
"ember-cli-babel"
]
}
}
There are a few things we can do here to avoid this confusion, add documentation about this.
We can also create an ember addon for non-embroider to consume .graphql
files.
I have created a super simple addon that does this:
https://github.com/josemarluedke/ember-cli-graphql-loader
There is no docs, just add it to your project and it should be good to go.
I am trying to use this addon in an ember app (ember@3.28.4) with ember-auto-import@2.2.3. When I am attempting to import schema.graphql anywhere in the app, it fails with "could not find module". Am I missing something