DEV Community

Discussion on: How to Hide your React Source Code from Chrome Dev Tools when Deployed to Production

Collapse
 
skaushiks profile image
Nilesh Sankrityayan

I added GENERATE_SOURCEMAP=false in .env but it didn't work.
In scripts, I added "build": "set \"GENERATE_SOURCEMAP=false\" && react-scripts build" but this also didn't work.
I am deploying my app on heroku and chose github as a deployment method.
Please help!

Collapse
 
myogeshchavan97 profile image
Yogesh Chavan

For Heroku, you need to add environment variables from UI. Goto you app in heroku -> Settings -> Config vars and click on Reveal Config Vars and then add GENERATE_SOURCEMAP with value false and then reploy the app.

Collapse
 
skaushiks profile image
Nilesh Sankrityayan

I did that as well but it isn't working. It works fine on netlify. I have deployed on netlify for now. But didn't work in heroku.

Thread Thread
 
myogeshchavan97 profile image
Yogesh Chavan

It does work on heroku. You might have missed something. Anyway, glad it's working on netlify for you.