Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts: Upgrade Babel to the new minor version (7.10.x) #22912

Closed
gziolo opened this issue Jun 4, 2020 · 0 comments · Fixed by #25351
Closed

Scripts: Upgrade Babel to the new minor version (7.10.x) #22912

gziolo opened this issue Jun 4, 2020 · 0 comments · Fixed by #25351
Labels
Needs Dev Ready for, and needs developer efforts [Tool] Babel preset /packages/babel-preset-default [Tool] WP Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.

Comments

@gziolo
Copy link
Member

gziolo commented Jun 4, 2020

Description

Babel 7.10.0 was release:

https://babeljs.io/blog/2020/05/25/7.10.0

One of the highlighted features is Better tree-shaking for React components:

React exposes many pure functions used to annotate or wrap elements, for example React.forwardRef, React.memo or React.lazy. However, minifiers and bundlers aren't aware that these functions are pure and thus they cannot remove them.

Thanks to Devon from the Parcel team, @babel/preset-react now injects /*#__PURE__*/ annotations in those functions calls to mark them as being safe to be tree-shaken away. We had only previously done this with JSX itself (<a></a> => /*#__PURE__*/React.createElement("a", null))

We don't use @babel/preset-react but I'm still wondering if this work could bring some performance gains.

References

It might be helpful to look at previous PR where minor version upgrade for Babel was applied: #21419. The changes that might be required:

  • all Babel related packages in @wordpress/babel-preset-default
  • Babel packages in the root package.json file
  • upgrading babel-loader in @wordpress/scripts
  • upgrading @babel/runtime in multiple packages
@gziolo gziolo added [Tool] WP Scripts /packages/scripts [Tool] Babel preset /packages/babel-preset-default [Type] Enhancement A suggestion for improvement. Needs Dev Ready for, and needs developer efforts labels Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Dev Ready for, and needs developer efforts [Tool] Babel preset /packages/babel-preset-default [Tool] WP Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant