How do I get meteor to build with the production build of React instead of the development build as it does now by default?
I would like to add a +1 here. It seems like a new issue, because I don’t remember it being a problem with my production react app a few months ago.
Are you referring to the fact that the chrome React developer extension falsely reports that production Meteor apps are using the development build of React? Because that’s a known issue. Meteor in production does in fact use the correct build.
That’s good to know. It seemed like that would be the case when I looked into how to build a production build. I don’t think it requires anything special that meteor’s minifiers aren’t already doing. Do you know what causes the extension to report that way?
More info here https://github.com/facebook/react-devtools/issues/687
So it looks like we need dead code elimination in the standard minifiers package to make that go away. (or we just ignore the silly message)
Actually, this is not a silly message: it really tells you that you’re shipping development checks. So your production build is heavier than it should and it doesn’t perform as fast as it should…
I’m one of the co-mainteners of this package that allows you to shave these bits off as it uses dead code elimination: ssrwpo:uglifyjs2.
I think there is an open issue for this on meteor. Maybe mdg merges your package into core?
Sadly, my PRs have been refused. As far as I understand the reason, there are some heavy minifier modifications these days. I guess that we will have to wait for it to settle. And in the mean time, for React users, our package should to the trick.
it works perfectly for my app and saves at least 30kb of gzipped app code (5%). Not much, but at least something
Does your package work with Meteor 1.5’s dynamic import?
I haven’t tested it yet with dynamic imports. Maybe other users / contributors have. It would be interesting to check and neat to contribute.