Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular definition of import alias 'createClient'. #224

Open
fdrissi opened this issue Jun 10, 2021 · 5 comments
Open

Circular definition of import alias 'createClient'. #224

fdrissi opened this issue Jun 10, 2021 · 5 comments

Comments

@fdrissi
Copy link

fdrissi commented Jun 10, 2021

Hello 馃憢 ,
I've followed the getting started part to install gqless, after generating the code using gqless generate I went to the index file to config queryFetcher.
I found this error:

import { createClient, QueryFetcher } from 'gqless'
Circular definition of import alias 'QueryFetcher'.
Module '"gqless"' declares 'QueryFetcher' locally, but it is not exported.

this is my gqless config file:

/**
 * @type {import("@gqless/cli").GQlessConfig}
 */
const config = {
  react: true,
  scalarTypes: { DateTime: 'string' },
  introspection: { endpoint: 'MY_ENDPOINT', headers: {} },
  destination: './src/gqless/index.ts',
  subscriptions: false,
  javascriptOutput: false,
}

module.exports = config

and this is the installed dependencies:

"dependencies": {
    "@gqless/react": "^2.0.15",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "@types/jest": "^26.0.15",
    "@types/node": "^12.0.0",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "clsx": "^1.1.1",
    "focus-visible": "^5.2.0",
    "gqless": "^2.0.14",
    "graphql": "^15.5.0",
    "npm-run-all": "^4.1.5",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-query": "^3.16.0",
    "react-scripts": "4.0.3",
    "typescript": "^4.1.2",
    "web-vitals": "^1.0.1"
  },

@PabloSzx
Copy link
Contributor

PabloSzx commented Jun 10, 2021

This seems to be an error with your building process, because QueryFetcher is being exported, but it's a type export, not an actual javascript export

@PabloSzx
Copy link
Contributor

can you try changing the first lines to

import { createClient } from 'gqless';
import type { QueryFetcher } from 'gqless';

@fdrissi
Copy link
Author

fdrissi commented Jun 10, 2021

thank you for your quick response @PabloSzx, I tried it but still the same error

@PabloSzx
Copy link
Contributor

can you create a repository with the issue happening please?

@fdrissi
Copy link
Author

fdrissi commented Jun 10, 2021

btw, it works when I import it like this:

import { QueryFetcher } from 'gqless/src/Schema'
import { createClient } from 'gqless/src/Client'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants