New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorthand imports and require.extensions #20
Comments
Yeah I think that would be fine! It's not really Babel though since it's not js right? It would be a separate tool probably that people would link into their gulp setup or whatever. |
In a discussion I just had with @stubailo, we decided to implement the simplest version for now, which is to write and export an array of Strings. The only thing we have to do is de-duplicate the strings at the end. I'll make a PR implementing this shortly. |
Here's what it's going to look like:
|
I would have expected:
Are we flattening arrays? |
Haha, I was just going to edit my post right now :D I implemented it with flattenDeep, but for some reason it doesn't feel right to me, so I changed it to apply the spread like you wrote. |
Have to export functions that return an array (instead of just exporting an array directly) to allow cyclical imports, but everything else stays the same. |
It would be nice to be able to import schema definitions with a .graphql extension, but it appears that require.extensions has been deprecated and there are some good reasons not to use it.
If we don't use require.extensions, the .graphql files would have to be transpiled, which requires a bit more setup, but would be more maintainable in the future. The transpilation setup could be mitigated by having a boilerplate and really good documentation. I'm also under the impression that most people are now using Babel by default, so it might not actually be such a big hassle to require a transpilation step.
@stubailo What do you think?
The text was updated successfully, but these errors were encountered: