Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GENERATE_SOURCEMAP=false Issue

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"
like image 988
Vikram Hegde Avatar asked Jul 18 '19 11:07

Vikram Hegde


4 Answers

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

You can find more info about source maps here.

like image 34
Josh Yager Avatar answered Oct 21 '22 17:10

Josh Yager


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.

like image 192
Yuvraj Patil Avatar answered Oct 21 '22 17:10

Yuvraj Patil


Also you can try the below setting in your scripts if you are running on windows

"build": "set \"GENERATE_SOURCEMAP=false\" && react-scripts build"

like image 11
CodeBuggy Avatar answered Oct 21 '22 16:10

CodeBuggy


Use cross-env to safely set environment variables across multiple operating systems:

"build": "cross-env GENERATE_SOURCEMAP=false react-scripts build"

like image 11
Alexandru-Dan Pop Avatar answered Oct 21 '22 15:10

Alexandru-Dan Pop