-
Notifications
You must be signed in to change notification settings - Fork 48.5k
include minified build with npm module? #683
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
Comments
Also related to the npm module: I can note that this is using browserify, which may have something to do with it. If its not immediately apparent what's wrong I can open a separate issue. |
@porterjamesj strange, I'm using browserify as well and the following works fine. Are you doing something similar? <a onClick={this.myHandler}></a> |
@porterjamesj I tried to reproduce and it works fine, you can see my setup at https://gist.github.com/andreypopp/a49df77285ae2609a6e2 |
@porterjamesj regarding time of browserifying, in the previous case it takes about 1.8s to produce a bundle on MBA2012, which is a bit long... but during development I use watchify so on changes it doesn't rebuild entire bundle from scratch. |
Right now our minified build just uses browserify on the original package + uglify. As a result, there are still Underscore doesn't have that problem as it's all 1 file to begin with with no modules. |
@andreypopp It's not browserifying that's slow for me; it's minifying the browserified bundle, which takes on the order of minutes. Problem with react as opposed to react tools must have something to do with my onClick setup; will investigate. Odd that it works with one but not the other though. |
@andreypopp your example works for me, so clearly the problem lies with my code. |
heh; turns out I was requiring I do still think it would be nice to include the minified version in the npm module fwiw. |
@porterjamesj do you want to serve minified React separately or just prepend it to your own code and not pipe through uglify? Because otherwise I don't see how you would extract performance gains from already minified build. At the same time, you probably would want minification only for production builds, does this happen so frequently to be annoying? Also
so |
With
|
FWIW, just browserifying+minifying react is not quite the same as react.min.js. react.min.js strips out extra logging and error messages. Since we use envify, you'll want to make sure |
@zpao yeah, but |
@andreypopp you're right that minifying doesn't need to happen frequently so it's not that big of an issue. @zpao thanks for the info! |
Setting NODE_ENV to production should improve runtime perf too. I would prefer to not check in minified code. Let's instead make sure that we can minify with existing tools in a performant way. Sound good? |
Makes sense; thanks for tips everyone. |
To clarify what @petehunt meant, it would improve runtime perf of React, not the browserification runtime. Glad we could help @porterjamesj! |
Minifying it myself takes forever; would be nice to be able to type
var React = require('react/react.min.js');
and be done with it (underscore does this, for example).The text was updated successfully, but these errors were encountered: