To disable source maps for React application, we set the GENERATE_SOURCEMAP environment variable to false.
For instance, in package.json, we write
{
"scripts": {
"start": "react-scripts start",
"build": "GENERATE_SOURCEMAP=false react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
to set the GENERATE_SOURCEMAP environment variable to false before running react-scripts build to disable source map generation in the build script.