How do you tell React to build in Production mode and what will that do?

Technology CommunityCategory: ReactHow do you tell React to build in Production mode and what will that do?
VietMX Staff asked 3 years ago

Typically you’d use Webpack’s DefinePlugin method to set NODE_ENV to production. This will strip out things like propType validation and extra warnings. On top of that, it’s also a good idea to minify your code because React uses Uglify’s dead-code elimination to strip out development only code and comments, which will drastically reduce the size of your bundle.