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