feat(babel-preset-kyt-react): add babel-plugin-pure-static-props when productionTransforms is true #1075
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
relates to DSYS-10
Description
This PR adds
babel-plugin-pure-static-props
tobabel-preset-kyt-react
's set of production transforms (enabled when the preset'sproductionTransforms
option is set totrue
).Motivation / Background
Static properties on [React] components break tree-shaking: styled-components/babel-plugin-styled-components#245 (comment)
This same commenter created
babel-plugin-pure-static-props
to address this. From its README:This is an especially important optimization for
babel-preset-kyt-react
because we add the static propertydisplayName
to every React component viababel-plugin-add-react-displayname
. That is, this plugin is always enabled. (For that reason, we may consider always enablingbabel-plugin-pure-static-props
as well.)