Often when you don’t do the optimization itself, the size of the build can grow quite large once all the files you are importing are placed in the same output, including its dependencies.
There are, however, techniques to circumvent this problem. The most common of these is the code-splitting, that is to divide your code into multiple parts. The React documentation has a section on this.
You can still use services such as Bundlephobia, which checks the size of a given dependency, or Packages like the webpack-bundle-analyzer
to check the size of your Bundle.
Finally, it is important to note that the size of the folder build
rarely matters. What you should take into account when developing a performance application is the size of the Bundle of Javascript of each page, and not the whole. Remember that in the directory build
live all the files and dependencies of your application. That way, if you have done the proper code-splitting, your application will probably not suffer from performance problems caused by the weight of Javascript files.
Thanks for the feedback, I loved Bundlephobia. The real question is why the server manager can’t deploy the application to Google Cloud Platform because build/Static/js has >1000 files, and I don’t understand how it went from 4 to over 1000 just like that, since I only moved from classes to Hooks and added "date-fns" to create a calendar
– dpsilvaa97
You should never build before deploy. It is advisable to build once the files are already on the server.
– Luiz Felipe