-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add step to generate stats.json file #1464
Conversation
* Added a step in the production build to generate a stats.json file in the build directory * To test I ran `npm run create-react-app my-app` went in to the my-app directory and ran `npm run build` and verified the stats.json file was output
Is there any different in build time because of this? |
Any suggestions for checking the build times? |
|
(Run it several times to get a better sample, both with and without the change.) |
I ran Without:
With:
And here is all the times. Without:
With:
|
I know concerns have been expressed before of switching away from webpack (I know it's probably unlikely), but I think it's worth noting that we're exporting something specific to webpack which may result in a breaking change in the future. I'd be more interested in learning what people believe is valuable about the build stats and implementing them ourselves in a standardized create-react-app format. |
I'm not very concerned about being webpack-specific since this is an extra bonus and not a vital part. If you want to analyze the bundle, it might as well be bundler-specific, and you might want to switch the analyzer tool if we switch the bundler. However I'm more concerned about Webpack stats being misleading about the source size because (AFAIK) they count modules before minification. Other insights it provides (like prefetching opportunities during compilation) are useless without access to the config anyway. AFAIK source-map-explorer is a more reliable (and bundler independent) analyzer, and maybe we should promote / integrate it instead. It doesn't need a special file either. |
@gaearon I can implement source-map-explorer instead in this PR. |
How do you imagine the integration? |
I came up with a couple implementations. Either just add some documentation to the |
Let's start with this. Want to send a PR? |
Ok I will do that. |
Closing this one for now then. |
in the build directory
npm run create-react-app my-app
went in to themy-app directory and ran
npm run build
and verified the stats.jsonfile was output.
Add some analyze script for npm packages #798