From 0d070ba3fdc0ce8661fd478c9d603e74b3369588 Mon Sep 17 00:00:00 2001 From: Ben Scott Date: Tue, 27 Aug 2024 16:37:17 -0700 Subject: [PATCH] Use absolute import path when importing apollo-codegen legacyIR Fixes import error when using the mjs version of the graphql-tool-utilities package with node --- .changeset/strange-dingos-confess.md | 5 +++++ packages/graphql-tool-utilities/src/ast.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/strange-dingos-confess.md diff --git a/.changeset/strange-dingos-confess.md b/.changeset/strange-dingos-confess.md new file mode 100644 index 0000000000..d6d778d4f8 --- /dev/null +++ b/.changeset/strange-dingos-confess.md @@ -0,0 +1,5 @@ +--- +'graphql-tool-utilities': patch +--- + +Fix import of apollo-codegen-core when using the mjs version of the package diff --git a/packages/graphql-tool-utilities/src/ast.ts b/packages/graphql-tool-utilities/src/ast.ts index fa216f081d..d4d374b412 100644 --- a/packages/graphql-tool-utilities/src/ast.ts +++ b/packages/graphql-tool-utilities/src/ast.ts @@ -8,7 +8,8 @@ import type { LegacyInlineFragment, LegacyOperation, } from 'apollo-codegen-core/lib/compiler/legacyIR'; -import {compileToLegacyIR as compileToIR} from 'apollo-codegen-core/lib/compiler/legacyIR'; +// Explicit js extension as it is required for the esm build +import {compileToLegacyIR as compileToIR} from 'apollo-codegen-core/lib/compiler/legacyIR.js'; export enum OperationType { Query = 'query',