In windows when I tried to build react app I am getting error saying 'GENERATE_SOURCEMAP' is not recognized as an internal or external command.
I have added below line in my package.json file
"build": "GENERATE_SOURCEMAP=false react-scripts build"
In windows when I tried to build react app I am getting error saying 'GENERATE_SOURCEMAP' is not recognized as an internal or external command.
I have added below line in my package.json file
"build": "GENERATE_SOURCEMAP=false react-scripts build"
Keep this in package.json:
"build": "GENERATE_SOURCEMAP=false react-scripts build",
"winBuild": "set \"GENERATE_SOURCEMAP=false\" && react-scripts build",
Use npm run build
for creating build on Linux.
Use npm run winBuild
for creating build on Windows.
Another solution is to create a new file in your project's root directory named .env and include the following inside the file. This will remove any .map files from your build/static/js folder the next time you run build.
GENERATE_SOURCEMAP=false
Use cross-env
to safely set environment variables across multiple operating systems:
"build": "cross-env GENERATE_SOURCEMAP=false react-scripts build"
Also you can try the below setting in your scripts if you are running on windows
"build": "set \"GENERATE_SOURCEMAP=false\" && react-scripts build"
For windows
like
"build": "set GENERATE_SOURCEMAP=false && react-scripts build"
,this command also can be used to remove .map files after generated
"build": "react-scripts build && del build/static/js/*.map"
For Cross Platform: Just open .env
and add GENERATE_SOURCEMAP=false
Linux: GENERATE_SOURCEMAP=false
Windows:
set \"GENERATE_SOURCEMAP=false\"
create a file name .env
add this code to the file : GENERATE_SOURCEMAP=false
On Heroku, go to Settings -> Config vars -> add GENERATE_SOURCEMAP with value false
On Vercel, go to Settings -> Environment Variables -> add GENERATE_SOURCEMAP as key and False as value, set environment Production -> Save
If you are using Heroku, you have to add this in the Config Vars inside the settings of your App. This is the way is supposed to be set from the documentation documentation