-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
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.