ReactJS remove sourcemap files after build

Emir Buğra KÖKSALAN tarafından tarihinde yayınlandı

I’m creating ReactJS applications using “create-react-app” command. Then it creating a fresh react application and I’m using it. I’m coding and coding then building with “npm run build” command. Everything is nice until here but there is a problem after finishing build. It creating a map file under build/static/js/main.[uniquid].map file and this is unnecessary and huge.

Why is this creating I don’t know (probably it’s purpose is debugging in browser). I don’t want it in production. Nobody will use this file. I don’t want that shit file. I googled this issue and found a solution. The solution is in HERE.

In short way solution is that: insert a script for after build and delete unnecessary files. For this there is two things to do.

  1. Install “rimraf” library globally with “npm“: sudo npm install rimraf -g
  2. Add this line to your package.json file after “build” line: “postbuild”: “rimraf build/**/*.map”,

That’s all. After this time you don’t have to load that shit “map” file to FTP or browser. Have a nice day.


Emir Buğra KÖKSALAN

Java & PHP Developer

0 yorum

Bir yanıt yazın

Avatar placeholder

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Time limit is exhausted. Please reload the CAPTCHA.

Bu site, istenmeyenleri azaltmak için Akismet kullanıyor. Yorum verilerinizin nasıl işlendiği hakkında daha fazla bilgi edinin.