← back to blog

How I Boosted Lighthouse Score From 55 to 93 With One Line of Code

____________________

For years our React + Vite app was forcing users to download ~10MB on every page load with completely uncompressed bundles. That alone kept our Lighthouse score stuck in the low 50s.

The Fix

Add gzip and brotli compression (some browsers don’t support brotli):

import viteCompression from 'vite-plugin-compression';

export default () => {
  return {
    plugins: [viteCompression()],
  };
};

This is a must have package if you are using Vite and React. Not only does it improve lighthouse score, it also significantly reduces the payload users download every page load.

If your app feels slower than it should, check your compression. It’s an easy win to improve app performance.

image

image (1)