How to disable source maps for React JS Application

Bharath Pabba picture Bharath Pabba · Aug 23, 2018 · Viewed 41.7k times · Source

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"
  },

Answer

Kyaw Kyaw Soe picture Kyaw Kyaw Soe · Aug 23, 2018

just remove &&

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