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

前端 未结 7 1771
说谎
说谎 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条回答
  •  醉话见心
    2020-12-08 15:46

    On a windows machine, this helped me

    "build": "set 'GENERATE_SOURCEMAP=false' && react-scripts build",
    

    Incase you are using react-app-rewired you can try the below.

    I have used a package called as cross-env. It can inject your environment variables.

    "build": "cross-env GENERATE_SOURCEMAP=false react-app-rewired build"
    

提交回复
热议问题