create-react-app is showing all my code in production, how to hide it?

前端 未结 7 1752
说谎
说谎 2020-12-08 15:23

In my chrome sources tab, I am able to view all my files by exact folder location. How can I hide them?

These weren\'t the problem in my previous project, w

7条回答
  •  萌比男神i
    2020-12-08 15:50

    Here are three ways to hide code.

    1. Using .env File.

    GENERATE_SOURCEMAP=false
    

    2. Using command line.

    GENERATE_SOURCEMAP=false react-scripts build
    

    3. Using package.json

    scripts: {
      "build": "GENERATE_SOURCEMAP=false react-scripts build"
    }
    

提交回复
热议问题