You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Is there an existing issue for this?
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.
The text was updated successfully, but these errors were encountered: