-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Babel: transpile class properties for wider browser support #2749
Babel: transpile class properties for wider browser support #2749
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b664423:
|
See also #2748 (comment) |
Everything looks good here. This is all I'm seeing changing in the build (without the code change from #2748). The static transform looks a little weird, but it doesn't look to break tree-shaking. class ErrorBoundary extends React.Component {
constructor(...props) {
super(...props)
this.state = {
error: false,
}
}
componentDidCatch(err) {
this.props.set(err)
}
render() {
return this.state.error ? null : this.props.children
}
- static getDerivedStateFromError = () => ({
- error: true
- });
}
+ErrorBoundary.getDerivedStateFromError = () => ({
+ error: true,
+}) Thanks, I'll keep an eye out on bettering transpilation here. We target |
Yep, old times :)
Good to know. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@react-three/fiber](https://github.com/pmndrs/react-three-fiber) | [`8.10.1` -> `8.10.4`](https://renovatebot.com/diffs/npm/@react-three%2ffiber/8.10.1/8.10.4) | [![age](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/compatibility-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/confidence-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pmndrs/react-three-fiber</summary> ### [`v8.10.4`](https://github.com/pmndrs/react-three-fiber/releases/tag/v8.10.4) [Compare Source](https://github.com/pmndrs/react-three-fiber/compare/v8.10.3...v8.10.4) #### What's Changed - fix: transpile class properties for wider browser support by [@​belgattitude](https://github.com/belgattitude) in [https://github.com/pmndrs/react-three-fiber/pull/2749](https://github.com/pmndrs/react-three-fiber/pull/2749) **Full Changelog**: pmndrs/react-three-fiber@v8.10.3...v8.10.4 ### [`v8.10.3`](https://github.com/pmndrs/react-three-fiber/releases/tag/v8.10.3) [Compare Source](https://github.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.2...v8.10.3) ##### What's Changed - fix(types): add loadAsync to Loader interface by [@​Methuselah96](https://github.com/Methuselah96) in [https://github.com/pmndrs/react-three-fiber/pull/2742](https://github.com/pmndrs/react-three-fiber/pull/2742) - fix: refactor ErrorBoundary to not use public class fields by [@​belgattitude](https://github.com/belgattitude) in [https://github.com/pmndrs/react-three-fiber/pull/2748](https://github.com/pmndrs/react-three-fiber/pull/2748) ##### New Contributors - [@​belgattitude](https://github.com/belgattitude) made their first contribution in [https://github.com/pmndrs/react-three-fiber/pull/2748](https://github.com/pmndrs/react-three-fiber/pull/2748) **Full Changelog**: pmndrs/react-three-fiber@v8.10.1...v8.10.3 ### [`v8.10.2`](https://github.com/pmndrs/react-three-fiber/releases/tag/v8.10.2) [Compare Source](https://github.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.1...@react-three/fiber@8.10.2) #### What's Changed - fix: portal injects by [@​drcmda](https://github.com/drcmda) in pmndrs/react-three-fiber@0c288ba - fix(RTTR): backport traverse, update fixes by [@​CodyJasonBennett](https://github.com/CodyJasonBennett) in [#​2736](https://github.com/pmndrs/react-three-fiber/issues/2736) **Full Changelog**: pmndrs/react-three-fiber@v8.10.1...v8.10.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ziyadedher/ziyadedher). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTkuNSIsInVwZGF0ZWRJblZlciI6IjM0LjEyMi4xIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@react-three/fiber](https://github.com/pmndrs/react-three-fiber) | [`8.10.1` -> `8.10.4`](https://renovatebot.com/diffs/npm/@react-three%2ffiber/8.10.1/8.10.4) | [![age](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/compatibility-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@react-three%2ffiber/8.10.4/confidence-slim/8.10.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pmndrs/react-three-fiber</summary> ### [`v8.10.4`](https://github.com/pmndrs/react-three-fiber/releases/tag/v8.10.4) [Compare Source](https://github.com/pmndrs/react-three-fiber/compare/v8.10.3...v8.10.4) #### What's Changed - fix: transpile class properties for wider browser support by [@​belgattitude](https://github.com/belgattitude) in [https://github.com/pmndrs/react-three-fiber/pull/2749](https://github.com/pmndrs/react-three-fiber/pull/2749) **Full Changelog**: pmndrs/react-three-fiber@v8.10.3...v8.10.4 ### [`v8.10.3`](https://github.com/pmndrs/react-three-fiber/releases/tag/v8.10.3) [Compare Source](https://github.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.2...v8.10.3) ##### What's Changed - fix(types): add loadAsync to Loader interface by [@​Methuselah96](https://github.com/Methuselah96) in [https://github.com/pmndrs/react-three-fiber/pull/2742](https://github.com/pmndrs/react-three-fiber/pull/2742) - fix: refactor ErrorBoundary to not use public class fields by [@​belgattitude](https://github.com/belgattitude) in [https://github.com/pmndrs/react-three-fiber/pull/2748](https://github.com/pmndrs/react-three-fiber/pull/2748) ##### New Contributors - [@​belgattitude](https://github.com/belgattitude) made their first contribution in [https://github.com/pmndrs/react-three-fiber/pull/2748](https://github.com/pmndrs/react-three-fiber/pull/2748) **Full Changelog**: pmndrs/react-three-fiber@v8.10.1...v8.10.3 ### [`v8.10.2`](https://github.com/pmndrs/react-three-fiber/releases/tag/v8.10.2) [Compare Source](https://github.com/pmndrs/react-three-fiber/compare/@react-three/fiber@8.10.1...@react-three/fiber@8.10.2) #### What's Changed - fix: portal injects by [@​drcmda](https://github.com/drcmda) in pmndrs/react-three-fiber@0c288ba - fix(RTTR): backport traverse, update fixes by [@​CodyJasonBennett](https://github.com/CodyJasonBennett) in [#​2736](https://github.com/pmndrs/react-three-fiber/issues/2736) **Full Changelog**: pmndrs/react-three-fiber@v8.10.1...v8.10.2 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ziyadedher/ziyadedher). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTkuNSIsInVwZGF0ZWRJblZlciI6IjM0LjEyMi4xIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Enable transpilation of public class properties in babel.
See https://babel.dev/docs/en/babel-plugin-proposal-class-properties
Linked to #2748
Before
Class properties in the dist
After
Class properties are transpiled
Sizes
Seems a very small size increase:
76505
vs76444
bytes (in the esm build)ls -la ./dist