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:

  1. npm install --save source-map-explorer

Alternatively you may use yarn:

  1. yarn add source-map-explorer

Then in package.json, add the following line to scripts:

  1. "scripts": {
  2. + "analyze": "source-map-explorer 'build/static/js/*.js'",
  3. "start": "react-scripts start",
  4. "build": "react-scripts build",
  5. "test": "react-scripts test",

Then to analyze the bundle run the production build then run the analyzescript.

  1. npm run build
  2. npm run analyze