Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Setup & Build Tools" doesn't explain the crucial development/production difference #10

Open
gaearon opened this issue Jun 24, 2017 · 2 comments

Comments

@gaearon
Copy link

gaearon commented Jun 24, 2017

Like many beginner-oriented tutorials, it doesn't mention the difference between development and production builds. Unfortunately, this leads to people shipping development builds to production.

If the guide only used Create React App, this would not be a large problem since CRA strictly divides development (npm start) and production (npm run build) environments. However this is a section that tries to explain Webpack/Babel alone. I'm worried that people learning using that section will get the impression that the result is production-ready. (It's not.)

I think that if the guide chooses to explain Webpack rather than use CRA, it also needs to explain development/production configs, and show examples of both. It is important to teach people to think about these as two separate environments, and that one must never deploy a development bundle to production.

@dabbott
Copy link
Owner

dabbott commented Jun 24, 2017

Good thinking!

What would you recommend for a bare minimum production-ready build for a React app? Is webpack -p sufficient?

@gaearon
Copy link
Author

gaearon commented Jun 25, 2017

No, it's not sufficient. You also need to add DefinePlugin. I really recommend to have two configs because even if -p works for some cases, people will add DEV-only stuff there by mistake.

We have official instructions for configuring Webpack for production.

https://facebook.github.io/react/docs/optimizing-performance.html#webpack

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

No branches or pull requests

2 participants