Closed nagman closed 5 years ago
I've bumped into the same error. However, it seems that there is some magic going on during compilation that throws this error. Do not try to dump loader
to the console. Do you get the same error when you are simply using the loader, i.e. loader("./path/to/some.graphql")
?
In my case, I'm getting no error when using loader("./path/to/some.graphql")
but the error only appears as soon as I'm creating a new variable const myGraphQlFile = "./path/to/some/graphql"; loader(myGraphQlFile);
.
@nagman Why did you close this? Did you find a solution?
Actually it's been a while since I've resolved it.
But I forgot to close this thread, and now I don't remember how I solved it.
Here's my config: package.json
"graphql": "^14.2.1",
"graphql-request": "^1.8.2",
"graphql.macro": "^1.3.5",
no .babelrc
in react
import { loader } from 'graphql.macro';
const getThingsQuery = loader('./getThings.graphql');
getThings.graphql
{
getThings {
id
}
}
Thanks for the ping back. No solution for me unfortunately, but I'm glad it was solved on your end :)
Same here, happening when I try to use path to file from a variable. I'd wanted to load a bunch of graphql-files from an array, but it doesn't allow that :(
Hi,
I'm using
graphql.macro@1.3.5
withcreate-react-app@16.8
, and when I try to importloader
fromgraphql.macro
, it throws me this:I'm not really sure how to setup babel macros, so I may have forgotten a dependency (by the way, is
graphql
really needed?).Here's my config:
package.json
.babelrc
src/components/App.tsx