Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

Request: a way to use the production React build with this #88

Closed
jedwards1211 opened this issue Jul 22, 2015 · 2 comments
Closed

Request: a way to use the production React build with this #88

jedwards1211 opened this issue Jul 22, 2015 · 2 comments

Comments

@jedwards1211
Copy link

Unless I misunderstand, I haven't seen a Webpack config yet that uses the production React build in production. They all seem to get it from the npm package, which still prints warnings, checks PropTypes, etc. I'm trying to figure out if it's possible to configure Webpack so that I can require() React from this pre-bundled production build, so if you have any idea, would you mind letting me know?

@cesarandreu
Copy link

When you generate a production build you should be using webpack.DefinePlugin, and passing it { 'process.env.NODE_ENV': '"production"' }. That'll cause the conditional process.env.NODE_ENV !== "production" to becomes "production" !== "production", so uglifyjs will do dead code elimination and remove all the prop checks and warnings.

@jedwards1211
Copy link
Author

Oh, okay, cool! I had tried running webpack with the env command, but the output bundle was no smaller than before. Or maybe I don't have UglifyJS configured. But I wasn't aware of the DefinePlugin, that's good to know. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants