vuejs / apollo

🚀 Apollo/GraphQL integration for VueJS
http://apollo.vuejs.org
MIT License
6.01k stars 521 forks source link

Latest version v4.0.0-beta.4 causes regression in CI with ES imports with @vue/apollo-composable #1462

Closed pixelbucket-dev closed 1 year ago

pixelbucket-dev commented 1 year ago

Describe the bug When running the Github unit test runner for our code base (Jest), the process breaks with a SyntaxError.


    /home/runner/work/portal/portal/node_modules/@apollo/client/core/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { DEV } from "../utilities/globals/index.js";
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

       5 | import { createPortalApplication } from '@/setup/create-portal-app';
       6 | import { provide, h } from 'vue';
    >  7 | import { DefaultApolloClient } from '@vue/apollo-composable';
         | ^
       8 | import { apolloClient } from '@/api/graphql/graphql.client';
       9 |
      10 | createPortalApplication({

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1495:14)
      at Object.<anonymous> (node_modules/@vue/apollo-composable/src/util/toApolloError.ts:1:44)
      at Object.require (src/main.js:7:1)
      at require (src/main.spec.js:27:7)
      at Object.isolateModules (src/main.spec.js:25:10)

Node version is 16.

To Reproduce Not sure how.

Expected behavior This does not break with v4.0.0-beta.3.

Versions vue: 3.2.47 vue-apollo: 4.0.0-beta.4 @apollo/client: 3.7.9

Additional context We only use one function from the library:

import { useQuery } from '@vue/apollo-composable';
pixelbucket-dev commented 1 year ago

https://github.com/vuejs/apollo/commit/aaa040c827868be457220c6440cc2f3577bccea5 does not seem to have fixed the specific problem described above. Could we, please, reopen the issue?

pixelbucket-dev commented 1 year ago

Could we please reopen? Latest betas still have this bug.

ebisbe commented 11 months ago

This is happening to us as well.