6

Actually, I'm developing a React App and I'm using React Script 2.0 to build it. The weird thing is after I compiled with the react-scripts build command and serve the app with Nginx I'm still allowed to check the state with React Dev Tools, also if I go to Source in Chrome I can see my components as if they weren't compiled.

Does anyone know what I'm doing wrong?

enter image description here

Talha Rahman
  • 720
  • 4
  • 12
  • 27
  • This is expected behaviour. The app is built with source maps. – Estus Flask Mar 01 '19 at 17:20
  • Welcome to Stack Overflow! What is the image link in the last line for? Anyway, try to remove the React Dev Tools for production: https://github.com/facebook/react-devtools/issues/191. To solve the source issue, delete the `*.map.js` files from the built folder or change the parameter `devtool` of Webpack – jpenna Mar 01 '19 at 17:21
  • Thanks both of you for your reply :D – Luis Chavez Mar 01 '19 at 21:42

1 Answers1

5

Just add GENERATE_SOURCEMAP=false in you .env file then it will stop making *.map files and browser will not show folders in source tab
Run this command for create .env file and write GENERATE_SOURCEMAP=false in it

echo GENERATE_SOURCEMAP=false > .env

Happy coding...!

Talha Rahman
  • 720
  • 4
  • 12
  • 27