Skip to content

Replaces static property assignments on React components so that tree-shaking will work correctly

Notifications You must be signed in to change notification settings

Mattgic/babel-plugin-pure-static-props

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-pure-static-props

DEPRECATED

This plugin is deprecated in favor of styled-components/babel-plugin-styled-components#248. It's possible that something other than styled-components might cause a similar issue, in which case this plugin might still be useful, but I won't be maintaining it. (Also, my implementation for babel-plugin-styled-components is a bit more efficient than what I did here.)


Fixes an issue with tree shaking that can occur when using static properties on React components using styled-components.

This plugin replaces static property assignments on React components (e.g. MyComponent.defaultProps = {...}) with Object.assign() statements annotated with /*#__PURE__*/ comments so that tree-shaking will work correctly.

About

Replaces static property assignments on React components so that tree-shaking will work correctly

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%