How to disable source maps for React JS Application How to disable source maps for React JS Application reactjs reactjs

How to disable source maps for React JS Application


just remove &&

"scripts": {        "start": "react-scripts start",    "build": "GENERATE_SOURCEMAP=false react-scripts build",    "test": "react-scripts test --env=jsdom",    "eject": "react-scripts eject"  }


You have to create a .env file in your root directory (same folder as package.json) and set GENERATE_SOURCEMAP=false on a single line.

for additional configurations, you may refer to the documentation here:https://facebook.github.io/create-react-app/docs/advanced-configuration


What I have tested and which is working is to add this code in your .env.production file or .env file

GENERATE_SOURCEMAP=false