Added developmentSourceSelfoption to gatesource/self in jsxDEV#17845
Added developmentSourceSelfoption to gatesource/self in jsxDEV#17845rootvector2 wants to merge 3 commits intobabel:mainfrom
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61093 |
|
commit: |
|
HI @JLHwung |
JLHwung
left a comment
There was a problem hiding this comment.
Thank you, this PR looks good to me.
I marked this PR as a breaking change because we will not release new minor for Babel 7 and the new output may not work with old React versions.
Could you also prepare a docs update to the babel-website? Specifically, we will need a migration note mentioning this change in https://github.com/babel/website/blob/main/docs/v8-migration.md
|
The CI error is not related and has been fixed on main. I will rebase this branch to make the CI green. |
17ec005 to
9fa3a62
Compare
Done i have prepare a docs update to the babel-website... |
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Thanks, this looks good to me and I agree with the new default.
I don't know if we'll have another Babel 7 minor release, but if we do, do you think we should backport this PR (with the default value flipped to true)?
|
yeah I think backporting makes sense. with the default set to |
| pragma: PRAGMA_DEFAULT = DEFAULT.pragma, | ||
| pragmaFrag: PRAGMA_FRAG_DEFAULT = DEFAULT.pragmaFrag, | ||
|
|
||
| developmentSourceSelf: DEVELOPMENT_SOURCE_SELF = false, |
There was a problem hiding this comment.
This option should be passed from createPlugin, rather than the returned plugin callback. The main plugin should not be aware of the developmentSourceSelf option.
…tions Move developmentSourceSelf from the Options interface (user-facing plugin options) to the createPlugin factory parameter. This ensures the main plugin is not aware of the developmentSourceSelf option. The preset-react now imports createPlugin directly and passes developmentSourceSelf when creating the development plugin instance.
9fa3a62 to
6b7b62d
Compare
React 19.2 removed the
sourceandselfparameters fromjsxDEV. Babel still unconditionally generates them in development mode which causes unnecessary overhead.This PR adds a
developmentSourceSelfoption to@babel/plugin-transform-react-jsxand@babel/preset-react. When set totruethe plugin generates__sourceand__selfas before. The default isfalsein Babel 8 so the output aligns with the current React runtime.Users who still need these arguments (e.g. older React versions or custom runtimes) can opt back in:
{ "presets": [ ["@babel/preset-react", { "development": true, "developmentSourceSelf": true }] ] }