Open wasd171 opened 7 years ago
There's no way to do it at the moment :( If this is a Common Thing (I don't know much about GraphQL, someone contributed it), then we can make GraphQL always run through Babel
Actually I was the one who contributed it =) I think sometimes people prefer to run TypeScript -> ES7 -> Babel , so perhaps it makes more sense in this context
So I was thinking of something more generic, not only GraphQL-specific
@wasd171 I definitely see the concept but I also worry it will make the internals super super complicated without much payoff in terms of real-world scenarios
I'm not sure how common of a use case it is, but I find myself wanting this feature within the first couple days of starting to use electron-compile.
My particular use case is with TypeScript + ant design. I am wanting to use babel-plugin-import
to get on-demand component + style imports. Unfortunately, I am not able to apply more than one transform to files that have been picked up and compiled by the TypeScript compiler.
This actually makes some of the available tsc options that are intended to be used with multiple transforms (e.g. jsx: preserve
) unusable. I think @wasd171 is correct in that TSC > Babel pipeline is a popular use case.
I just fixed a bug which is ultimately caused by the fact that you can apply multiple transforms. (In this bug, the "passthrough" compiler for, say, text/less
forwards to text/less
which forwards to text/less
...) I think the problem is just that text/jsx
is not a valid JSX encoding mapped to Babel. You should try emitting as application/javascript
. I think based on how those path names were exploding it will get a filename extension looking like .graphql.js
or so, but that's presumably fine. Don't give up!
I'd like to use babel plugin for rewriting import paths in my .graphql files. Is it possible to apply graphql-compiler + babel?
I tried to change mimeType of graphql output to
text/jsx
, but babel does not catch it