using absolute paths for importing GraphQL causes an error
See original GitHub issueAbsolute paths configuration:
// .babelrc
{
"plugins": [
"import-graphql"
]
}
// jsconfig.json
{
"compilerOptions": {
"baseUrl": "."
}
}
Import code:
import {qPosts} from 'schema/post.graphql';
Gives the error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at Array.map (<anonymous>)
If using relative import path there is no error. e.g.
import {qPosts} from '../schema/post.graphql';
I have two projects, one using version 2.8.1 and one using 2.7.0 with the same .babelrc and jsconfig.json both cannot use absolute imports with babel-plugin-import-graphql but work using relative imports.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:15
- Comments:8
Top Results From Across the Web
Issues · detrohutt/babel-plugin-import-graphql
Contribute to detrohutt/babel-plugin-import-graphql development by creating an account on ... using absolute paths for importing GraphQL causes an error.
Read more >How to change relative paths to absolute paths for imports
I have a React project set up using webpack, eslint, flow and jest. Here is a documentation of the places that require configurations...
Read more >Using eslint with typescript - Unable to resolve path ...
In my eslintrc.js config file, the "import/resolver" object needed to sit within the "rules" node, not the " ...
Read more >Avoiding Import Issues in TypeScript Monorepos
Importing elements from the same library through the library's path mapping/through a barrel will cause issues for sure, whether that is circular ...
Read more >Configuring absolute paths in React for Web without ...
We are already accustomed to having autocomplete when we are going to import the files using relative paths. This error happens because VSCode ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is this plugin doesn’t take the set
baseUrl
into account. I worked around the issue in my project by dynamically setting thenodePath
option to the absolute path of thebaseUrl
like this:We ended up just using
graphql-tag
in.js
files. I wrote a script to convert them.