graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

Using recommended react-app preset for code splitting brings in undesired transform-exponentiation-operator babel transformation

Open egucciar opened this issue 2 years ago • 3 comments

Which packages are impacted by your issue?

@graphql-codegen/client-preset

Describe the bug

Using recommended react-app preset for code splitting brings in undesired transform-exponentiation-operator babel transformation

The only change we made in our webpack config was adding react-app preset as recommended, but this caused ** to be converted to Math.pow

Your Example Website or App

xx

Steps to Reproduce the Bug or Issue

xx

Expected behavior

xx

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • NodeJS: [e.g. 18.5.0]
  • graphql version: [e.g. 16.3.0]
  • @graphql-codegen/* version(s): [e.g. 2.6.2]

Codegen Config File

No response

Additional context

No response

egucciar avatar Nov 02 '23 20:11 egucciar

@egucciar can you share a reproduction repo? maybe with a diff of before and after the change?

Urigo avatar Nov 19 '23 14:11 Urigo

@Urigo we wound up manually polyfilling BigInt, but unfortunately we have new problems (sorry for the delay of my response, I've been out of the weeds with the codegen since we ultimately landed it in our production app).

Unfortunately BigInt wasnt the only thing that was broken in the fallout of being required to use react-app as a preset for the Gql codesplitting to work.

It also seems to have stripped and removed all the polyfills, which is causing more production issues and uncaught exceptions we didn't have before.

I already spent multiple hours trying to debug react-app preset and get it to work for us when i filed this one month ago, but settled for polyfilling BigInt manually. Now we can see the issue is more pervasive. We could make a minimal repro if needed, but ideally, we could be instructed on how to configure our Webpack config to codesplit GQL without bringing in the bloated react-app preset which causes conflict with our ability to polyfill things in our app.

egucciar avatar Dec 01 '23 00:12 egucciar

This is still an issue for our team, as we have had to remove the react-app preset to bring back our polyfills. I've asked for help using the graphql guild to be given an alternative configuration to get the code splitting to work. I'd love to get more help with this. Is it not expected for the react-app preset to interfere with polyfilling?

egucciar avatar Dec 12 '23 18:12 egucciar