facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
224.31k stars 45.71k forks source link

fix(compiler): avoid escape non-English character #29124

Closed himself65 closed 1 month ago

himself65 commented 1 month ago

Summary

Fixes: https://github.com/facebook/react/issues/29120

Related: https://github.com/babel/babel/issues/9804

How did you test this change?

react-sizebot commented 1 month ago

Comparing: 3f1436cca1f8dd80a19fd52b97b6ff71a4d9ce82...646437520aae45c6a9c22222d3407d02f3db6770

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.66 kB 6.66 kB +0.11% 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 495.01 kB 495.01 kB = 88.68 kB 88.68 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 499.81 kB 499.81 kB = 89.36 kB 89.36 kB
facebook-www/ReactDOM-prod.classic.js = 592.16 kB 592.16 kB = 104.15 kB 104.15 kB
facebook-www/ReactDOM-prod.modern.js = 568.39 kB 568.39 kB = 100.55 kB 100.55 kB
__test_utils__/ReactAllWarnings.js Deleted 64.26 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show | Name | +/- | Base | Current | +/- gzip | Base gzip | Current gzip | | ---- | --- | ---- | ------- | -------- | --------- | ------------ | | [__test_utils__/ReactAllWarnings.js](https://react-builds.vercel.app/commits/646437520aae45c6a9c22222d3407d02f3db6770/files/__test_utils__/ReactAllWarnings.js?compare=3f1436cca1f8dd80a19fd52b97b6ff71a4d9ce82) | **Deleted** | 64.26 kB | 0.00 kB | Deleted | 16.02 kB | 0.00 kB

Generated by :no_entry_sign: dangerJS against 646437520aae45c6a9c22222d3407d02f3db6770

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 7:40am
himself65 commented 1 month ago

I changed the behavior from modifying the babel config to changing StringLiteral to Template.

Some feedback from @SukkaW that we cannot modify babel config in many cases

himself65 commented 1 month ago

So many breaking changes to tests. I don't think this is a good change

josephsavona commented 1 month ago

Thanks for submitting this! The fix is a bit more involved, we should only apply the workaround if necessary (if babel would escape incorrectly). I'm also going to investigate if there is some way to just get the right escaping in older versions of babel.