edit: I solved this by using electron-builder, it uses webpack under the hood so all problems are handled well by default. I post this question as I used electron-forge and electron-packager at first, and although I searched several resources I still couldn't wrap my head about the difference among electron-forge/electron-packager/electron-builder
original question:
I built an electron app with electron-forge using react and typescript, but I found out it contains my whole typescript source code in the distribution.
After dug around, it seems that there's no way to get rid of the source, even asar
could be extracted easily. Minifying the source code may be the most "proper" way to keep others from just copy and paste my project. I figured may be I can achieve this by utilizing the afterCopy
hooks provided by electron-packager, but don't know how exactly I should do it, any suggestions?