Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[graphiql] CommonJS syntax in ESM build #3668

Closed
1 task done
janitza-anjakr opened this issue Jul 30, 2024 · 1 comment · Fixed by #3746 or #3747
Closed
1 task done

[graphiql] CommonJS syntax in ESM build #3668

janitza-anjakr opened this issue Jul 30, 2024 · 1 comment · Fixed by #3746 or #3747

Comments

@janitza-anjakr
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

in our dev environment, we integrated GraphiQL in a React app (using Vite). While everything runs smoothly in dev mode, runtime errors occur in our final build when executing subscriptions. In the console, we get the following error messages: "require is not defined"

We did some digging and indeed found CommonJS syntax in the esm artifact, see for example: node_modules/@graphiql/toolkit/esm/create-fetcher/lib.js (line 58)

Luckily for us, vite offers an option to transform those require statements when setting build.commonjsOptions.transformMixedEsModules to true in our vite.config.ts.

Expected Behavior

We expect that graphiql offers an esm build without CommonJS syntax.

Steps To Reproduce

No response

Environment

"@graphiql/toolkit": "^0.9.1",
"graphiql": "^3.3.2",

Anything else?

Thanks in advance for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants