How to disable source maps for React JS Application

前端 未结 8 1002
时光说笑
时光说笑 2020-12-08 19:15

My react folder structure is as below

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

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 19:33

    Solution for ejected create-react-app v2.1.3.

    Go to /config/webpack.config.js directory and change the following line:

    const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
    

    To:

    const shouldUseSourceMap = false;
    

    And Bob is your uncle.

提交回复
热议问题