-
Notifications
You must be signed in to change notification settings - Fork 75
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
Meteor specific issues #8
Comments
Do you mean react-router or is there something called reaktor router? And I assume you're talking about loading these libs through Meteor packages?
Only thing I don't remember is how to give the bundle access to the |
And yeah I wouldn't expect using FlowRouter with this setup to be easy, I wasn't going to even try going down a path like that, but definitely share your insights with everyone if you succeed. |
Oh cool I might try out that later. It might be easier to just use the Would this solve the issue of having a different dev/prod version of React? (I vaguely remember something about that being swapped in Reaktor Router is a facade over FlowRouter that looks a lot like react-router, without the nested UI. However for this upcoming project the app is much more like spotify than 'pages' so i'm going to def. use react-router for that. I'll get FlowRouter working sooner or later 😄 It seems like it was looking for the So far very little issues. I'm going to setup Velocity testing today. I'm assuming the velocity tests will need to be put in the I'm already using Karama outside of Meteor for React unit tests so that should just drop right in 👍 |
Actually I'm going to just put this feature into the project right now (getting React via this alias) |
👍 Cool. I'm working on implementing Meteor settings into the build step too. They're working really well. It even does a full reload when the settings file change. Meteor settings is used for things like setting up S3 keys for dev and production or public keys for the client. |
Uhoh, bad news. So |
I decided I'll make a branch later that uses |
Ah, bummer. I don't think it'll be too big of a deal. The worst case scenario is you can fork the package and add an |
btw.. I think having the react-hot-loader should be the default one. What do you think? For me that was one of the biggest perks (my current prod app takes 8 seconds to do a reload 😦 ) I can also see how not having Just spitballing here but what if we create a Meteor package that does an NPM require for ReactMount, and exposes a global that we can resolve in webpack. We can set a debug flag so it's never used in prod (only dev mode). It sounds like we couldn't do the above because any regular 'react' requires would use the NPM version instead right? |
@AdamBrodzinski wait a minute...I wasn't right about that at all! All we have to do is bridge in the other direction, sticking the React loaded by Webpack into |
Hmmm, you could leave out the runtime and just include the mixin and that would work for anything that the user creates. However if another packages requires If we could make a Meteor package that just pulls in ReactMount then we could use Also i'm not sure if this is the same ReactMount but there's a separate one on NPM https://www.npmjs.com/package/react-mount that might be useable to alias/resolve At any rate the developer experience will be 100x better if we can figure out how to use the Meteor React package. It's not a big deal to me but I can foresee people getting confused and frustrated. |
Unfortunately that Think about what a problem it is that a lot of Meteor packages were created solely to pull in some 3rd-party library, and in this case there are two incompatible ones doing the same thing that other packages might depend on. I'm really hoping Meteor eventually turns into something you just npm install, so that all 3rd-party Meteor packages just depend on Meteor and React or whatever else in their I think we should just accept that there will be a bit of confusion and frustration when making a Frankenstein of tools like this -- to me it's still less frustration than trying to use React the way Meteor Development Group wants us to :) |
Agreed! I look at it like a fussy Lamborghini... it doesn't always run the way you want and the trim may fall off but once it's running it's an animal 😆
Yep same here. I'm hoping that when they do release ES6 modules it's going to be based on strictly NPM. I wouldn't mind the current atmosphere/packaging system to be deprecated. IMHO you could have all new > 1.3 packages be NPM, older legacy packages could still load in globally as they do today and when 2.0 rolls around remove the deprecated global packaging. At any rate once we get these smoothed out i'll get some of the core devs to have a serious look at this since it can be used as a sandbox/strawman for the future Meteor ES6 modules. |
Also wrapping any npm & deps is frankenstain.. I hope mdg and community will agree in a structure like this asap |
Cool, I'm glad to hear you guys share my concerns. I'm sure a lot of MDG insiders have been thinking about this for awhile too. Sometimes I thought that since (as far as I've heard?) Meteor is backed by venture capital, they're using the package system to get people locked into their ecocsystem kind of like Microsoft does, but probably they're wiser than that. |
No, I don't want to think bad things about MDG, simply they wanted to guarantee a fullstack experience and are trying to do a smooth migration path, but now the ES2015 (and beyond) community is too strong and mantaining the Meteor platform "as is" is just slowing down the adoption of what is cool outside of Meteor (DDP). Interesting Matt Debergalis (MDG) interview https://www.youtube.com/watch?v=hA4sToBHkPs |
Yea i think that their solution was great 4 years ago when it first came out and AMD was the only browser module system and Browserify was buggy at best. However now that NPM is being used for clientside JS, it makes more sense to switch. |
Wow, I didn't realize Meteor was 4 years old. Though that definitely explains the package structure. |
So as far as getting React from the Webpack bundle into Meteor, I just discovered that by cloning the There would still be some more work to make the React instance used in the Webpack bundles available to them though. The obstacle is that the client bundle is currently the very last thing that gets loaded, which means its React instance wouldn't be available for any Meteor packages when they're loaded. The solution, I assume, would be:
|
Hmm interesting! I haven't had time to dive into chunks too much... I tried reading the docs and my eyes were glazing over without any concrete examples 😆 That plan sounds good to me. The only thing we'd want to double check is that if we fork the I mean at the end of the day package authors _should_ be using weak dependancies for React so in my opinion it would be the package maintainer's fault. If the above fork didn't work, if we could just figure out how to get the chunk to load before the packages and then as long as the packages use a weak dep, no copies of React will load. Then we don't even have to maintain a fork. If this would work a script could run to grep for so something like this?
|
It's the Heck, we could have the npm scripts insert the latest version of the real |
Oh cool! 🍻 Should I hold off on pushing my PR with the different structure? I can have that ready tonight or I can push it later and update it if that helps. |
I'm trying to think. I put the version that loads React from the Commons Chunk in a |
Okay, done with that. Yeah merge the master branch into your fork and then make a PR. I'll probably have to merge your changes into the |
er...I'm not thinking, the changes from the master branch won't merge cleanly into your fork anyway. Would it be too much trouble to just make sure your fork has the latest versions of the webpack config files and run scripts, adapt the paths in them as necessary, and make sure the scripts all work? |
I've often wondered if there's a Webpack option to make it expose its |
Sounds good to me. I was also going to go over every commit to make sure I didn't miss anything too, so it should be up to date with master once I go over it. Then i'll add the karma stuff after that. |
Aha, this may be solution for the REPL! from http://webpack.github.io/docs/configuration.html:
|
Wooooo nice! |
Cool! Yea that should be fixed in the master of the upstream... Before it deleted the entire client folder instead of just the file. |
@tomitrescak Ah I see the issue now. Commit 39d4d0 adds a gitignore with a glob which made the lib/configs.js file not get checked in. It just had the following in it: // Tell FR to wait until our ES6 code is fully initialized
FlowRouter.wait(); This is now updated here Thanks! |
Been playing with it 14 hours straight ;) But finally got it where I want it, including typescript support (not through loader though as I prefer to compile it in atom). FYI, for typescript all you have to do it to rename jsx to tsx and use following notation: import * as React from "react";
interface Props {
foo?: string;
}
interface State {
bar: string;
}
// React.Component<Props,State>
class MyComponent extends React.Component<Props, State> {
render() {
return <span>{this.props.foo}</span>
}
}
export default MyComponent; Also to support Semantic UI or Bootstrap a file-loader had to be added with a following configuration {
test: /(\.png|\.gif|\.eot|\.svg|\.woff|\.ttf)/, // we need this to load fonts
loader: 'file'
} But that's just info for other noobies like me ;) If you'll ever need I can prepare a typescript supported version for you (with typings). |
Sorry for the OT. I'm using with this project Cerebral and cerebral-router and it works fine, it also support pinterest-style routing. |
@AdamBrodzinski I think you can rewrite that require as @tomitrescak I've seen this loader config for supporting bootstrap that I got from someone else and have used in all my projects without investigating more deeply if it's necessary:
|
Cool!
I think so. I haven't tried it yet since it's not quite stable. I'm super interested in send data down part.
That would be cool! The type defs always confuse me lol. If you compile with webpack you also get hot module loading (not an entire page refresh)... not sure if the atom one will do that. I also forgot to pull the react-transform from the blaze fork/branch.... that's not being used if there's no React. @jedwards1211 cool I'll have to try that! I need to dig into the complete module syntax 😄 |
@AdamBrodzinski @tomitrescak if you guys want to PR anything like this to be a different branch, just let me know and I'll create a branch for it (I don't know if there's any easier way to do this with PRs?) |
@jedwards1211 cool, if you could create a blaze branch i'll cleanup the fork and PR. Just have to take a bit of react stuff out of it. |
@AdamBrodzinski the typescript loader from webpack seems to be having issues with .tsx file (typescript rich jsx) and it is giving all kind of errors, atom-typescript allready has a full support for it. The hot code reload still works flawlessly, since I made You do not have to use the @jedwards1211 please prepare a Typescript branch for me and I'll prepare a typescript PR. |
@AdamBrodzinski just letting you know that I made the typescript loader work, but it breaks the hot code reload functionality. I guess the problem is with compilation chaining, where loader is specified as following:
After a module is modified, I always receive message on client requesting full page reload. Using extrenal compiler (such as the one in atom), make everything work silky smooth Zohan style ;) |
I just began working on another Meteor/React tool you guys might find useful. Check it out! |
@tomitrescak branch created! |
@AdamBrodzinski and your branch created too! |
@jedwards1211 Wooooo that looks really nice! I didn't even know about seamless-immutable. This just made my day!! (that's kind of sad actually 😆 ). Having immutable collections would be ideal! Have you used seamless-immutable before? Looks nice! rtfeldman is the Elm guy... too cool (really good JavaScript Jabber podcast on Elm if you're into that)
Cool, thanks! Do you know if you're going to merge PRs #36 #37 #38 ? if not I should prob. take those out of the Blaze fork so they're congruent |
Ahhh I wonder if it has something to do with react-transform and jsx. It's now using babel transforms. Did you try one of these loaders? These seem to be the most popular. Taking out (this) and trying these loaders may give you the hot module patching if that's preferred. https://www.npmjs.com/package/typescript-loader |
@AdamBrodzinski I just converted my work project from Immutable.js to seamless-immutable and it's pretty nice. It's a bit rough around the edges and lacks some basic conveniences that Immutable.js has, and I almost want to fork it 😜 but it is more seamless than Immutable.js. With that and my new seamless immutable cursor thing, writing this frontend is going to be a breeze! |
@AdamBrodzinski oh man nice, I didn't know |
@AdamBrodzinski so I changed my mind about seamless-immutable...I'm making an Immutable.js version of my cursor thing instead |
Oh bummer, is there a reason to switching to Immuable js? The seamless one seemed so nice I was planning on using in my ReactNative project. Were there any deal breakers (outside of the mongo project)? |
@AdamBrodzinski Things I didn't like:
Here's the new project, I've been tweaking it all day: https://github.com/mindfront/meteor-immutable-observer |
Guys, I am still discovering the full extent of using typescript and some changes had to take place so I'll probably put it together during the weekend. I have one question though: Do you think it is a good idea to pack all CSS in the main HTML file? Semantic UI packs 450KB of CSS + ste CSS can come up all the way to 600-700KB, even with GZIP compression and others it still pumps quite a big chunk into the main file. Or does this happen only on DEV? |
@jedwards1211 ah thanks for the info!
I think webpack does some analysis to determine if it's faster inline or as a sep. file request (heres a great video on that in general, To see if it does this in prod you can run Also as a workaround you can place it in your meteor_core css directory and it will get bundled as normal there (or even add a CDN tag in the head in meteor_core). |
@tomitrescak Are you talking about Meteor pumping CSS into the HTML or Webpack? Webpack doesn't pump anything into the HTML file, when you use stylesheets with it they get put in the JS bundle and loaded by it somehow. |
Oh maybe I was thinking of webpack inlining base64 images instead of css. |
@AdamBrodzinski @jedwards1211 I'm talking about webpack pumping CSS into main HTML. It all rests in the head/style. But as suggested, putting it to the meteor-core directory should resolve the problem as meteor packs all css in one file, although I really liked the fact that webpack packed only used CSS and not all, significantly reducing the front end library cr@p. I really like what you have done, having the possibility to debug JavaScript directly in the original .jsx files is like a dream. The only thing I did not fully comprehend is that debugger attaches at random. Placing breakpoint in the render and reloading the page many times misses the breakpoint, but then I do some other operations and then it picks up. Events and component helpers break always, that is great. I have also decided to port our applications to React, I learnt that it keeps the project much cleaner and forces one to write more logically organised code. Also, the blaze templates do not work with your hot code reload. |
@tomitrescak oh, I forgot -- just to be perfectly clear here -- the webpack About debugging -- it's tough to tell, but I think these interfere with breakpoints:
And yeah naturally the Blaze templates wouldn't work with the hot code reload. Perhaps it would be possible to write some smarts into the React wrapper for them, but I'm not sure (probably it would have to require the template files directly instead of getting them via Meteor) |
I've been having this problem in React native too (no webpack and perhaps exacerbated with async/await)... not sure if it's a babel specific problem. I tend to throw in debuggers if this happens. I think using a
You might be able to load the base CSS in meteor_core and then use all of your hand-written stuff with the webpack css modules... a mix of both.
Yea I've found that it's helped me a ton! It's kind of like how functional programming makes you think about the problem in small separate problems and then you compose them together. Regarding a re-factor... this video helped me quite a bit: https://www.youtube.com/watch?v=BF58ZJ1ZQxY
I thought it should hot-load on a per module level, leaving the other blaze components in place.... can't remember off hand but I thought I could live edit html in chrome on blaze template A and then change blaze template B and then it would hot-load changes for just B leaving my local changes for A in chrome. I'll have to look into this more over the weekend 😄 |
Thanks a lot for the explanation, makes sense! Concerning the video, makes a lot of sense, it's just a bit difficult to combine blaze with react, vice versa is doable. I did a PR for the typescript demo. Had to change some components and added some small bits to demo he differences, but I hope it is still in line with your demos. I still have to figure out the typescript loader so that it works with hote code reload. My demo does not contain Flow Router, I can add it if you want. I had to extract the flow layout from arunoda as react is not available for meteor components. This brings me to my question. Where do you see this project after 1.2 when React will become part of the core? I guess nothing changes ... Still will be aweosme:) |
The reason hot-reloading blaze templates doesn't work is that nothing indicates that the |
Hi , I am facing a very odd issue , after login using meteor account password package or any social login package I am calling Meteor.user() and getting user data , however if I go to other route after that , and calling Meteor.user() I am not getting any data , Please help I am total stuck here. |
I think it would be a good idea to keep track of known issues with Meteor compatibility for new users that come across this. I'll try to knock these off as I have time. Feel free to close if this is unwanted.
meteor_core
for them to runThe text was updated successfully, but these errors were encountered: