Electron: Reached heap limit Allocation failed - JavaScript heap out of memory

I had this problem because I have ~40000 of python files in the project. I was able to remove unnecessary files and resolve it. Posted details here.