Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !3945

Allow bundles to be analyzed with Webpack-specific tools

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/joshwcomeau/bundle-stats into next Jan 31, 2018
  • Overview 21
  • Commits 2
  • Pipelines 0
  • Changes 3

Created by: joshwcomeau

Associated issue: #1858 (closed)

To analyze Webpack bundles, a "stats" JSON is required.

This PR allows that file to be created and saved to the build directory, so that users can use it with Webpack-specific insight tools like webpack-bundle-analyzer without ejecting their application.

Updated the README to include details for how to do this.

Test plan

1. check that the stats flag works

I ran yarn build --stats in the root directory of the project. Once it completed, I verified that build/bundle-stats.json existed. I dragged it into Webpack Visualizer to check that the file is correct:

screen shot 2018-01-31 at 8 46 57 am

2. check that it works in a created project

I ran yarn create-react-app test to generate a new app.

After cd-ing into the directory and installing its dependencies, I followed the steps I added to the the README for using webpack-bundle-analyzer. Specifically I ran:

$ npm install --save webpack-bundle-analyzer

Then, I opened the project's package.json and added a script:

"analyze": "npm run build -- --stats && webpack-bundle-analyzer build/bundle-stats.json",

Finally, I ran the new script:

$ npm run analyze

The project built, and a new browser window automatically opened, with the bundle stats: screen shot 2018-01-31 at 8 42 14 am

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/joshwcomeau/bundle-stats