Skip to content

Miss configured sourcemaps ? #9

@benjamindulau

Description

@benjamindulau

On a project created with create-react-app, I get the following error when starting or building the app:

Capture d’écran 2023-01-11 à 12 06 02

Incriminated code:

// src/config/apollo-client.ts

import { ApolloClient, createHttpLink } from "@apollo/client";
import { setContext } from "@apollo/client/link/context";
import { createPersistedQueryLink } from "@apollo/client/link/persisted-queries";
import { usePregeneratedHashes } from "graphql-codegen-persisted-query-ids/lib/apollo";
import hashes from "../gql/persisted-query-ids/client.json";
import { apolloCache } from "./apollo-cache";

export default function initApolloClient(session: any) {
  const httpLink = createHttpLink({
    uri: window.ENV.GRAPHQL_SERVER_URL,
  });

  const authLink = setContext((_, { headers }) => {
    return {
      headers: {
        ...headers,
        authorization: `Bearer ${session.appToken}`,
      },
    };
  });

  const persistedQueryLink = createPersistedQueryLink({
    useGETForHashedQueries: false,
    // eslint-disable-next-line
    generateHash: usePregeneratedHashes(hashes),
  });

  return new ApolloClient({
    link: authLink.concat(persistedQueryLink).concat(httpLink),
    cache: apolloCache,
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions