DEV Community

Cover image for 5 Things to do before making the build for Production. (React JS)

5 Things to do before making the build for Production. (React JS)

Atul Bhatt on August 24, 2021

This article is not something you might not already know but maybe you might not have it all listed in a one place. There can be more things that I...
Collapse
 
arminops profile image
Armin Tor

What if we have a single logger service and check the environmnt?

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Can you please elaborate?

Collapse
 
arminops profile image
Armin Tor

For number 1. We don't want to log in our console in production. We can create a singleton service and check the environment before logging. By this we followed SRP too..

Thread Thread
 
atulbhattsystem32 profile image
Atul Bhatt

Nice one. Can you please write an article on it. Or maybe I'll do it when I'm done curating the other articles on my list 😃

Thread Thread
 
arminops profile image
Armin Tor

I'd love to, but am so busy these days... I'm sure you'll write a good one until i want to start :)))

Collapse
 
manisha11dev profile image
manisha-11-dev

Thanks much for posting this.

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Welcome Manisha.😀
Thanks for commenting. It keeps me fueled up for writing more of such posts.

Collapse
 
manisha11dev profile image
manisha-11-dev

Sure, appreciate such endeavours always and would love to contribute too.

Collapse
 
xtender profile image
𝙿𝚊𝚞𝚕 𝙺𝚊𝚖𝚖𝚊

I'm pretty sure that 1,2 and 3 is been done by webpack (or the responsible plugin) I mean who on earth would delete ALL comments before a production build in ALL files, the comments are there for (almost) a good reason?

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

Yes Paul. The production build is optimized and the points 1,2, and 3 are handled. However, removing those files that are not in need is also helpful in the sense that if other devs get through your project they don't have to scratch their head to find the reason for their existence. And having these processes already done may improve the time it takes to make the build.

But you are spot on with your pick. Thanks for that.
Do you have any point that you would like to add which we as a dev can do?

Collapse
 
ch1zo profile image
chizo nwazuo

Super useful tips! I was just going to build an app for production and didn't even know some of these. Thank you...

Collapse
 
atulbhattsystem32 profile image
Atul Bhatt

I'm super glad to know that the post reached to someone who really was in the same stage. Happy production deployment.😄

Collapse
 
walfredocarneiro profile image
Walfredo Carneiro

Super useful tips! Thank you!

Collapse
 
momosetti profile image
Momo Setti

for 1 and 2 steps, you could use linting rule for avoid getting that.