I have a React application, and I’ve noticed that when I open Chrome Developer Tools and go to the Sources
tab, I can see a folder named static/js
. Expanding this folder reveals the entire code of my React project. This seems concerning from a security perspective.
So I went with the GENERATE_SOURCEMAP=false
and it works for me for .js
files only. I can still see the .css
files in the Sources
tab in static
folder.
build: set "GENERATE_SOURCEMAP=false" && react-scripts build
How can I achieve to minify the css files? Does GENERATE_SOURCEMAP minifes js files only? How can I prevent the source code of my React app from being exposed in this manner? Is there a way to obfuscate or hide the code to enhance security?
Thanks in advance for your help!