detrohutt/babel-plugin-import-graphql

`fs` error importing fragments - `illegal operation on a directory`

develomark opened this issue · 4 comments

I am getting the following illegal operation on a directory error:

module build failed: Error: /Users/mark/intrusted-static-website/components/organisms/OnboardingChildren/OnboardingChildren.js: EISDIR: illegal operation on a directory, read
    at Object.fs.readSync (fs.js:693:18)
    at tryReadSync (fs.js:557:20)
    at fs.readFileSync (fs.js:600:19)
    at /Users/mark/intrusted-static-website/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:88:53
    at Array.forEach (<anonymous>)
    at processImports (/Users/mark/intrusted-static-website/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:85:17)
    at Object.processFragments (/Users/mark/intrusted-static-website/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:76:7)
    at PluginPass.exit (/Users/mark/intrusted-static-website/node_modules/babel-plugin-inline-import-graphql-ast/build/index.js:50:19)
    at newFn (/Users/mark/intrusted-static-website/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/Users/mark/intrusted-static-website/node_modules/babel-traverse/lib/path/context.js:76:18)

This works:

#import  "../fragments.graphql"

this produces the error:

#import { Fragment1 } from "../fragments.graphql"

Any thoughts as to what is causing the issue?

Thanks!

Hey @develomark thanks for trying out my package. AFAIK that second import is not a valid syntax for fragment imports, unless there have been some recent changes I’m unaware of. If you’ve seen that syntax used somewhere please link to it and maybe I can add it but for now only the first syntax is supported.

P.s. - You may be confusing that with this feature added to graphql-tag last month. That is also not supported in my package at the moment, although I do intend to add support for it in the near future.

I added the feature I mentioned. If you want to try it out use version 2.2.0-beta.1.

Hi @detrohutt sorry for the late reply. I shall try it out!