-
Notifications
You must be signed in to change notification settings - Fork 2
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
Split meteor-react mixins into a separate package? #11
Comments
I like this idea! Agreed on the problem, I really dislike wrapper packages for other libraries. I'd seen him announce the browserify package on the forums but hadn't played with it till getting this message. Thanks for the encouragement 😄 So yeah, I'm down to remove the vendor files from this package. I'll remove the files, include some instructions in the README on using cosmos:browserify, and bump it to v0.2. |
Just realized one semi-significant tradeoff in doing this. React's production version is more than just a minified version of development. There's some other optimizations that they do. That's why in the |
@elidoran I'm confused. If I use |
I've been working on my next comment. I can see how my initial code example seems confusing as it's not a solution. It's the first thing I noticed about this project. It doesn't need to maintain the vendor files inside it, and, because the I looked at material-ui. If you require it in a browserify.js file it'll use I looked at cosmos:browserify wouldn't select a file to include. What it does, is have the npm browserify module process your browserify.js file with the .npm/package/ folder as the target to find the npm modules required. It lets Meteor minify the result when building for production. So, doing So, if you use the prebuilt file then it shouldn't be browserified because it already is. If you want to browserify it yourself with cosmos:browserify then it won't produce the same as the prebuilt file because it targets react.js not addons.js (also, if its production file is customized instead of simply being minified). |
Hi @elidoran! Thanks for chiming in. Nice work on your package, clever workaround 👍 Here's my observations so far:
React = require('react/addons'); And then you get Unfortunately it doesn't look like envify is getting applied. I made a new Meteor app that only does this: var Thing = React.createClass({
render: function() {
this.props.foo = "Look I'm mutating props";
return (
<h1>Hello Poppet</h1>
);
}
});
document.addEventListener("DOMContentLoaded", function(event) {
React.render(<Thing/>, document.body);
}); When using the development version you get a warning not to mutate props. In production it should be silent. Normally you get the production version by setting I'm looking at the source being delivered to my browser and I see I didn't fully understand how that worked before, envify is pretty cool. I will go ahead and take the vendor files out and put a little how-to in the README for doing this, but also include a note that until we figure out the envify thing the extra warnings will be included |
In this package you bundle
react
+meteor-react mixins
, a problem I see with this approch is that if you want to use the rest of React ecosystem is problematic, because:grove:react
at every new react releaseAn alternative (ultimate :) ) approch could be:
What do you think?
The text was updated successfully, but these errors were encountered: