How to analyze the bundle size in React App
In this tutorial, we are going to learn about how to analyze the create react app bundle size using source-map-explorer.
Analyzing the bundle size
- First, we need to install a package called source-map-explorer in create react app using npm.
npm i source-map-explorerSource map explorer helps us to analyze the JavaScript bundles using source maps.
- Now, open your
package.jsonfile and add the following line toscriptsobject.
"analyze": "source-map-explorer 'build/static/js/*.js'",- Analyze the bundle size by running the following commands.
npm run build
npm run analyzenpm run build is used to build your react app code to production.
npm run analyze is used to analyze the code.


