Register and share your invite link to earn from video plays and referrals.

Kenneth Skovhus
@kenneth_skovhus
Flipping bits to bring back magic at @linear
Joined February 2016
1.5K Following    2.3K Followers
Recent performance fix: lazy-loaded CSS comes with a price. @vite_js build.cssCodeSplit helped us. Linear still uses CSS Modules for complex selectors not yet migrated to @stylexjs. When our module preloader warmed lazy-loaded chunks that contained CSS, it attached new stylesheets in quick succession. Each invalidated style and layout across the page, triggering 28 full-page layouts. 🥺 We fixed this by setting `build.cssCodeSplit` to false, which makes Vite emit one stylesheet. As StyleX already uses atomic CSS, the file size is acceptable and bounded. That introduced a new issue: Vite adds the file to the HTML as a render-blocking link, delaying our custom loader icon baked into the HTML. Our post-build step rewrites the link to media=print so it fetches early without blocking the loader. We wait for it to load, switch it to media=all, and only then render the app.
Show more