Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable source maps for React JS Application

My react folder structure is as below

enter image description here

I've not used the create-react-app version. I tried using GENERATE_SOURCEMAP=false. But It didn't work.

Where can I find the .map files. How can I delete those files?

I cannot find a build folder. I've tried using the below script But It cannot work in removing source maps

 "scripts": {      "start": "react-scripts start",    "build": "GENERATE_SOURCEMAP=false && npm run build",     "test": "react-scripts test --env=jsdom",     "eject": "react-scripts eject"   }, 
like image 526
Bharath Pabba Avatar asked Aug 23 '18 10:08

Bharath Pabba


People also ask

How do I turn on source map in react app?

In the inspection tool, click on the gear icon on the very top right of the window to open the settings page as shown below. In the preference tab, under the Sources subheader, make sure that Enable JavaScript source maps is enabled.

What are source maps in react?

Sentry supports demangling of transpiled, minified, and bundled JavaScript using source maps, which are JSON files that contain information about how to map your deployed code back to its original source(s).

How do I stop hosting the react app?

To stop this from running, in the command prompt, type CTRL-C. You will get the prompt to Terminate batch job: Type Y and the app will stop running: You can now run npm start again if you want to relaunch the app.


1 Answers

just remove &&

"scripts": {         "start": "react-scripts start",     "build": "GENERATE_SOURCEMAP=false react-scripts build",     "test": "react-scripts test --env=jsdom",     "eject": "react-scripts eject"   } 
like image 167
Kyaw Kyaw Soe Avatar answered Sep 20 '22 04:09

Kyaw Kyaw Soe