DEV Community

Yuvraj Chaudhari
Yuvraj Chaudhari

Posted on

How to reduce bundle.js / main.[hash].js size in react js?

In my react app, when I run npm run build then lot of chunk files are created and also one main.[hash].js file
and that main.[hash].js file size is ~138kb (attached screenshots below for reference)

Image description

Due to this performance of my app is getting low as per PageSpeed test or LightHouse test (attached screenshots below for reference) and its in Reduced unused Javascript
And in react app there's no such code which are unused

Image description
So how to reduce size of main.[hash].js file so that performance will increase ?

In this app I did not eject web-pack files so there no config file in this app
also I have already use code splitting technique like lazy/suspence in all routes.

Top comments (0)