meteor / meteor-feature-requests

A tracker for Meteor issues that are requests for new functionality, not bugs.
Other
89 stars 3 forks source link

Client side bundling doesn't eliminate dead code in production #94

Open benjamn opened 7 years ago

benjamn commented 7 years ago

Migrated from: meteor/meteor#6402

skirunman commented 7 years ago

It looks like this issue really had two parts. The first is as stated in the title "Client side bundling doesn't eliminate dead code in production" and the second was actually a "bug" as per this comment by @hwillson https://github.com/meteor/meteor/issues/6402#issuecomment-300343883 that was fixed with https://github.com/meteor/meteor/pull/8786

However, this fix is not working when we deploy to production on Galaxy nor is it working if we test in development by either passing in the --production flag or by setting NODE_ENV=production on the Meteor command line. In all cases we are still seeing the red React icon saying that our app is in development mode. When we run the process.env.NODE_ENV from Chrome browser console we are getting the expected return value of production.

Looks like others may be having the same issue. Any idea on what we are doing wrong here?

Tested with both Meteor 1.5.1 and 1.5.2-beta.8.

EDIT: We are using Material-UI and it is possible that our node_modules components are not being transformed.

ninjaPixel commented 7 years ago

We are using Material-UI

@skirunman FYI I'm also seeing this with an empty, vanilla React app too. Have tried with METEOR@1.5.2.1 and METEOR@1.6-beta.26

sunlee-newyork commented 7 years ago

+1, using Material-UI as well with Meteor 1.5.2.1

skirunman commented 7 years ago

Issue with not showing "production" version of React Developer Tools icon was resolved for us when we upgraded to Meteor 1.6-beta.30. Guessing maybe an updated version of Babel solved this for us? Meteor 1.6 is now a release candidate so maybe give it a try if you can.

santiagopuentep commented 7 years ago

For us the "production" version of React issue was solved by Meteor 1.5.2.

ninjaPixel commented 7 years ago

I'm still getting this issue. Have tried the latest METEOR@1.6-rc.2. BTW I'm using React v 16

aogaili commented 7 years ago

I'm getting this issue as well and I'm on 1.6-rc-3, but I was using abernix:minifier-js which I don't think has Benjamn's changes, the bundle visualizer is reporting that the react dom size is 294kb and I can see it has react-dom-development.js . Therefore I wan not getting an accurate report on the bundle size.

When I switch to meteor's standard-minifier-js, I didn't see the react-dom-development.js and the react dom file was reduced to 111kb but the the react dev tools is still complaining that the app includes an extra development build of React..

Also the console is reporting the following error (I'm using React 16):

Uncaught Error: React is running in production mode, but dead code elimination has not been applied. 
Read how to correctly configure React for production:
https://fb.me/react-perf-use-the-production-build
    at <anonymous>:21:35
screen shot 2017-10-06 at 8 45 59 am
vuhrmeister commented 7 years ago

I'm also getting this error message with Meteor 1.6 and React 16.1.1. The react-dom size is only 91kb though and the visualizer shows that it uses react-dom.production.min.js.

*edit: Just found that post here and it solved it: 👍 https://github.com/meteor/meteor/issues/9260#issuecomment-340869260

KoenLav commented 5 years ago

@benjamn this can be closed?