The tasks like minification, tree shaking can reduce code size, leading to quicker load times and less data usage. Build time optimization allows for more predictable software and improves performance, efficiency, and reliability. Case studies include GlueStack, which leverages a Babel plugin for build time styling computation, and React Native UStyle, with features such as aliases and virtual components.
The tasks like minification, tree shaking can significantly reduce the final size of the code. But you have a lot of power. You can also analyze what part of code is not used and even strip that out on top of optimization done by your bundlers. Hence, leading to quicker load times and less data usage for the end user.
Lastly, it allows for more predictable software. By doing as much as possible during the build time, we can have a better understanding of how our software will behave in production. In conclusion, the shift toward build time optimization is a natural progression and as we try to improve more and more on performance, efficiency and reliability. In software development, this trend is only going to go up from here.
Now, let's take a look at some case studies. So, first we have GlueStack. So, GlueStack UI v1 is used GlueStack style which has the capability to compute most of your styling needs at build time using a Babel plugin. This helped us to improve the performance of BISEX to 7x. Like we were converting all the computation of your theme tokens or your color mode styling, all those things at build time. And although now v1 is archived, but v2 also provides the same performance with the help of NativeWin. NativeWin is a package that aims to bring Tailwind styling to React Native and it heavily relies on build time using a compiler to do so. And we all love Tailwind and hence NativeWin, we all love too.
And then we have React Native UStyle. This is something I'm building in my free time lately and I'll quickly show you some of its cool features and how they are working internally. So, this is the React Native UStyle website and I'll quickly jump to the documentation. So, if you go to the usage, so this is the basic thing that it does is to, it's a drop in... First thing is it is a dropping replacement for React Native. So whatever you can import from React Native, you can import from React Native UStyle. And secondly, so if you were importing view, you can just write React Native UStyle and now your view will have this power to write aliases and theme tokens. So here, bg is background color and this is a theme token, then p is padding and so on. And you can define your tokens and aliases like this in a config file and this is fully typed. Okay, this is the first feature and the second feature is virtual components. So, this is something I'm excited about. So, what it does is you can define a component in your theme, like my view and you can provide this a tag. So, my view is tag view.
Comments