Company
Date Published
Author
Daniel Husar
Word count
1760
Language
English
Hacker News points
3

Summary

The Intercom Messenger is a modern react.js app with many components, third-party libraries, and stylesheets. To optimize its bundle size, Intercom embarked on an effort to reduce the size of the bundle by 65%. The steps taken included splitting out vendor packages into a separate bundle, which reduced the size from around 600kb to approximately 240kb. This change was made possible by using webpack bundler features and optimizing code duplication and rarely executed code. Additionally, refactoring the stylesheet by introducing a CSS-in-JS approach with Emotion library reduced the size of the bundle. The changes resulted in a faster Messenger experience for customers, shaving off up to five seconds of loading time on mobile devices. According to Google Lighthouse, the site now has a score of 100, up from the previous score of 59.