Skip to content

Commit 7ac42a3

Browse files
fix: client preset babel plugin esm runtime error (#9817)
* 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>
1 parent d0cdb8f commit 7ac42a3

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/client-preset': patch
3+
---
4+
5+
Resolve runtime error when using the babel plugin within an ESM environment.

packages/presets/client/src/babel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default declare<ClientBabelPresetOptions>((api, opts): PluginObj => {
5858

5959
const importPath = getRelativeImportPath(state, artifactDirectory);
6060

61-
const importDeclaration = template(`
61+
const importDeclaration = template.smart(`
6262
import { %%importName%% } from %%importPath%%
6363
`);
6464
program.unshiftContainer(

0 commit comments

Comments
 (0)