Search code examples
reactjstemplatesmaterial-uidashboard

hiding source maps on react


I am working with a minimal dashboard template and would like to push my website to production.

How could I hide the source maps on react?

FYI: using yarn to build

Tried varies guides from the internet, probably it is something really simple but as I am new to developing with react it proves to be more complicated than expected


Solution

  • You can set GENERATE_SOURCEMAP to false in build script. This is part of package.json.

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

    Also, you can create .env file on your root directory and set GENERATE_SOURCEMAP=false