webpack / react-starter

[OUTDATED] Starter template for React with webpack. Doesn't focus on simplicity! NOT FOR BEGINNERS!
2.21k stars 320 forks source link

Question about minification #21

Closed qfz closed 9 years ago

qfz commented 9 years ago

I found that "npm run build" produces very small js file comparing to just using uglify. Just wondering what you did to achieve such high level of compression? I tried to look at make-webpack-config.js, but couldn't find anything special there. Thanks.

sokra commented 9 years ago

react has a lot for debug code which is garded with if(process.env.NODE_ENV !== "production"). The DefnePlugin + uglify removes this code in the production build.

qfz commented 9 years ago

Thanks a lot, I thought if(process.env.NODE_ENV !== "production") was for nodejs server. It all makes sense now.