Skip to content

typescript can't find module .gql #180

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
franciscolourenco opened this issue Jul 15, 2019 · 1 comment
Closed

typescript can't find module .gql #180

franciscolourenco opened this issue Jul 15, 2019 · 1 comment

Comments

@franciscolourenco
Copy link
Contributor

It works fine if you change the language to js.

ERROR in /Users/user/code/reproduce-typescript-vue-cli-plugin-apollo/src/components/ApolloExample.vue
97:19 Cannot find module '../graphql/Files.gql'.
     95 |
     96 | <script lang="ts">
  >  97 | import FILES from "../graphql/Files.gql";
        |                   ^
     98 | import UPLOAD_FILE from "../graphql/UploadFile.gql";
     99 |
    100 | export default {
ERROR in /Users/user/code/reproduce-typescript-vue-cli-plugin-apollo/src/components/ApolloExample.vue
98:25 Cannot find module '../graphql/UploadFile.gql'.
     96 | <script lang="ts">
     97 | import FILES from "../graphql/Files.gql";
  >  98 | import UPLOAD_FILE from "../graphql/UploadFile.gql";
        |                         ^
     99 |
    100 | export default {
    101 |   data() {

vue cli reproduction: https://github.com/reproducing/reproduce-typescript-vue-cli-plugin-apollo

@jthomaschewski
Copy link

@Akryum this implementation causes issue when used with tools Graphql Codegen (Module Plugin: https://graphql-code-generator.com/docs/plugins/typescript-graphql-files-modules ).
Sometimes it's also desirable to use "*.graphql" as an any-module, which allows arbitrary imports.
e.g: import {myQuery, otherQuery} from 'queries.graphql'

Unfortunately Typescript doesn't have an option for excluding specific types. Only whitelist approach via types: [] in tsconfig. For this reason I had to downgrade vue-apollo.

I'd argue for these reasons this kind of type definition shouldn't be part of vue-apollo.
What do you think?

devs-cloud pushed a commit to devs-cloud/grapql_apollo_vue that referenced this issue Mar 1, 2020
RayDev1988 added a commit to RayDev1988/Vue_apollo_graphql that referenced this issue Mar 10, 2022
goldentroll added a commit to goldentroll/apollo that referenced this issue Mar 14, 2023
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