Skip to content

Commit

Permalink
fix: client preset babel plugin esm runtime error (#9817)
Browse files Browse the repository at this point in the history
* Fix Babel+ESM

Trying to fix #9774

* Add changeset

* Update .changeset/twelve-oranges-breathe.md

* Update .changeset/twelve-oranges-breathe.md

---------

Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
  • Loading branch information
nikitalocalhost and n1ru4l authored Jul 28, 2024
1 parent d0cdb8f commit 7ac42a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twelve-oranges-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-codegen/client-preset': patch
---

Resolve runtime error when using the babel plugin within an ESM environment.
2 changes: 1 addition & 1 deletion packages/presets/client/src/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default declare<ClientBabelPresetOptions>((api, opts): PluginObj => {

const importPath = getRelativeImportPath(state, artifactDirectory);

const importDeclaration = template(`
const importDeclaration = template.smart(`
import { %%importName%% } from %%importPath%%
`);
program.unshiftContainer(
Expand Down

0 comments on commit 7ac42a3

Please sign in to comment.