timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.81k stars 425 forks source link

Fix using new jsx transform in tests #501

Closed msbarry closed 3 years ago

msbarry commented 3 years ago

The new jsx transform is not working in tests when run through react-app-rewired (they fail with "ReferenceError: React is not defined"). Ported over this change from create-react-app: https://github.com/facebook/create-react-app/commit/2b1161b34641bb4d2f269661cd636bbcd4888406

timarney commented 3 years ago

@dawnmist any thoughts on merging this?

I haven't been keeping from v2 forward.

dawnmist commented 3 years ago

I haven't tried moving from v3 to v4 yet, but the code is matching what react-scripts itself is doing. I have checked it out and tested that things still work properly with react-scripts v3, so it is backwards-compatible/doesn't break things for people who haven't upgraded yet.