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
Currently, the values exported from *.css.js and generated by recipes() and createSprinkles(...args)() are calling some runtime functions in bundled files. For instance, recipes() calls createRuntimeFn.
So, if these values are not used in production code, the JavaScript bundlers such as esbuild and webpack does not remove them because calling a function might have side effects.
This new feature is useful when we build an UI library with vanilla-extract. Some components will use recipes in order to show multiple styles. All of them are not used in the same application, so those annotations will save the aplication's bundle size and performance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Background
Currently, the values exported from
*.css.js
and generated byrecipes()
andcreateSprinkles(...args)()
are calling some runtime functions in bundled files. For instance,recipes()
callscreateRuntimeFn
.So, if these values are not used in production code, the JavaScript bundlers such as esbuild and webpack does not remove them because calling a function might have side effects.
Idea
So, I hope that vanilla-extract plugin adds
/* @__PURE__ */
or/* #__PURE__ */
annotation to exported values.This new feature is useful when we build an UI library with vanilla-extract. Some components will use
recipes
in order to show multiple styles. All of them are not used in the same application, so those annotations will save the aplication's bundle size and performance.Beta Was this translation helpful? Give feedback.
All reactions