Hide console.log and network errors

I am developing web in react environment.

I have deployed and logged in, but I have witnessed a 401 being written to console.log when login fails.

POST https://www.hihi.com/auth 401 (Unauthorized) xhr.js:187

If an error message is output in this way, the backend API is exposed, which is very bad for security.

And when I open the Chrome network again, an error message is displayed again.

auth 401    xhr xhr.js:187  395 B   93 ms

I want to make it so that it does not show the Network error message or console.log error output.
Is there a library or compiler to make this invisible?