You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running this plugin if it's not required adds build time. In a lot of cases it's enough to check if styled-components are in devDependencies as well as peerDependencies.
Reasons for why this plugin is good for our libraries, like @sanity/ui are:
Without this plugin sc components that aren't used require analysis to be eliminated by pipelines that use vite, terser, webpack, turbopack or what have you.
With #__PURE__ annotations most tooling knows it's safe to remove the component if nothing imported in userland actually uses it.
Due to how much styled-components are used in @sanity/ui and in sanity itself, the benefits here can be substantial. Both in end user perf due to a smaller browser bundle, but also for cold starts in envs such as next dev.
The text was updated successfully, but these errors were encountered:
Running this plugin if it's not required adds build time. In a lot of cases it's enough to check if
styled-components
are indevDependencies
as well aspeerDependencies
.Reasons for why this plugin is good for our libraries, like
@sanity/ui
are:Most importantly, it performs dead code elimination:
https://styled-components.com/docs/tooling#dead-code-elimination
Without this plugin sc components that aren't used require analysis to be eliminated by pipelines that use vite, terser, webpack, turbopack or what have you.
With
#__PURE__
annotations most tooling knows it's safe to remove the component if nothing imported in userland actually uses it.Due to how much
styled-components
are used in@sanity/ui
and insanity
itself, the benefits here can be substantial. Both in end user perf due to a smaller browser bundle, but also for cold starts in envs such asnext dev
.The text was updated successfully, but these errors were encountered: