diff --git a/.changeset/twelve-oranges-breathe.md b/.changeset/twelve-oranges-breathe.md new file mode 100644 index 00000000000..58ee1b76ad9 --- /dev/null +++ b/.changeset/twelve-oranges-breathe.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/client-preset': patch +--- + +Resolve runtime error when using the babel plugin within an ESM environment. diff --git a/packages/presets/client/src/babel.ts b/packages/presets/client/src/babel.ts index 167564b8c11..1f1cb98da0b 100644 --- a/packages/presets/client/src/babel.ts +++ b/packages/presets/client/src/babel.ts @@ -58,7 +58,7 @@ export default declare((api, opts): PluginObj => { const importPath = getRelativeImportPath(state, artifactDirectory); - const importDeclaration = template(` + const importDeclaration = template.smart(` import { %%importName%% } from %%importPath%% `); program.unshiftContainer(