React build sourcemap remove

BackEnd_Ash.log·2020년 7월 13일
0

react

목록 보기
22/41

why you have to remove source map

when you build your React project create-react-app

By default, files bundled by webpack and sourcemaps corresponding to those files are created.

sourcemap is file for debug

if the file exists, the compressed and obfuscated file can be viewed again in the browser as the original source.

1. Internal code is exposed

Since the internal code is exposed as it is, all the benefits of obfuscation are lost. Projects that shouldn't be exposed can be fatal.

2. Out of memory (OOM) issues may occur during build

for large project ,
when you build , you create until sourcemap maybe you will happen out of memory phenomenon

solution
In this case, setting the build so that it does not generate sourcemap can solve the problem.

3. How do I remove it?

1. GENERATE_SOURCEMAP=false

You can set the environment variable GENERATE_SOURCEMAP to false. You can do this by adding GENERATE_SOURCEMAP=false to your .env file, but your personal preference is to modify package.json as follows

"build" : "GENERATE_SOURCEMAP=false react-scripts build"
profile
꾸준함이란 ... ?

0개의 댓글