TypeError: Object(...) is not a function


I am trying to migrate from the old apollo packages. I migrated and install @graphql/client and updated my code to only rely on @graphql/client. However, I still have an issue TypeError: Object(...) is not a function.

There are the version of the package

  • graphql@15.7.2
  • @apollo/client: @apollo/client@3.4.16

The file that causes the issue is the following

import {gql} from "@apollo/client";

export const GET_USER_PROFILE_BASIC = gql`
  query getUserProfileBasic {

This is the error I got in my react application

Any idea how to work around this issue?


Sounds like a problem with old packages in your lockfile. Or it could be that your bundler isn’t bundling the graphql package properly. Make sure it’s set up to bundle .mjs files properly