question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for '--profile' option for webpack from react-scripts build

See original GitHub issue

We had a problem this week where we may have let our production dependencies get a bit out of control and the output from yarn build jumped up in file size as well as time-to-generate.

To diagnose what might have been at fault, I dug around for a bit and found a profile option for webpack. The resulting json I was able to visualise in webpack-analyse and webpack-bundle-analyzer and compare with earlier commits. The latter provided a fairly useful tree map that helped us work out what had happened.

However, to run this my only option was to eject, or to run with the webpack conf directly:

NODE_ENV=production ./node_modules/webpack/bin/webpack.js --config node_modules/react-scripts/config/webpack.config.prod.js --profile --json

I feel like it would be useful to have --profile options for webpack available from react-scripts. The stats produced feel like they would be useful even if you were not doing anything complicated with your webpack setup. I guess it could be similar to react-scripts test and how it passes through options to jest. Actually this was my first guess when I was seeing if it was supported

yarn build -- --profile --json cheers

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:8
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Jan 8, 2018

Seems like the tools mentioned above are sufficient. Thanks for the issue though!

2reactions
Timercommented, Jul 7, 2017

You can actually use https://www.npmjs.com/package/source-map-explorer without the need to eject.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Everything you need to know about react-scripts
I hope this guide shed some light on the amazing configuration of Create React App. Not only does it come with useful scripts...
Read more >
Profile a React App for Performance - Kent C. Dodds
How to use the React DevTools and React's profiling build to properly profile a production app.
Read more >
Overriding the Create-React-App Webpack Configuration ...
Create -React-App is a great tool to bootstrap React apps, but it offers only limited access to the configuration of the production build....
Read more >
Using Webpack with React, Pt. 1 - Toptal
In this Webpack tutorial, we demystify Webpack/React configuration. Go beyond Create React App with Webpack customization tailored to the needs of your app....
Read more >
How to Upgrade to React 17 and Webpack 5 Step by Step
Make sure your Node version is above 10.13.0. > node -v v12. · Install Webpack 5. > yarn add webpack@latest yarn add v1.22.10...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found