Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Plugin makes it impossible to import .gql.ts and .graphql.ts files #91

Open
nielsmadan opened this issue Mar 15, 2022 · 1 comment
Open

Comments

@nielsmadan
Copy link

In order to import a file with .gql.ts extension, you would omit the .ts part in the import statement.

Since the plugin looks at importPath rather than the name of the actual file, it will handle it and import it as graphql, which will fail (assuming it is a ts file).

Attaching a patch that would fix it, but of course not sure if this has other implications.

babel-plugin-import-graphql+2.8.1.patch.txt

@ronaldosc
Copy link
Collaborator

ronaldosc commented Jun 2, 2024

@nielsmadan
I couldn't realize the use of those files with GraphQL syntax but added .ts extension.

The original extension is important to retain. If you change it to TypeScript syntax you'll need a parser, but GraphQL has this parser natively or with a package.

A granulated code with the GraphQL code separated fits better and you separate codes from different syntax brings more readability for developing.

What you suggest more about?

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

No branches or pull requests

2 participants