Analyzing the Bundle Size
Source map explorer analyzesJavaScript bundles using the source maps. This helps you understand where codebloat is coming from.
To add Source map explorer to a Create React App project, follow these steps:
npm install --save source-map-explorer
Alternatively you may useyarn:
yarn add source-map-explorer
Then inpackage.json, add the following line toscripts:
"scripts": {
+ "analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
Then to analyze the bundle run the production build then run the analyzescript.
npm run build
npm run analyze