-
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
Allow bundled geo.js to work in Candela #572
Conversation
Current coverage is 71.75%@@ master #572 diff @@
==========================================
Files 82 82
Lines 7070 7072 +2
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 5072 5074 +2
Misses 1998 1998
Partials 0 0
|
Thanks for looking into this. As I mentioned, I'm okay with making this change in general. To reiterate what I've said before, here are the problems that I see with this:
The only other comment I have is that we should probably remove jquery from the vendor bundle and add a copyright statement in the main bundle. |
@ronichoudhury thanks for this R. I am fine with this change as discussed as long as @jbeezley is happy with it. We will eventually move to es6 but will have to think carefully on removing complete dependency on JQuery. |
I also think code-splitting in Webpack can help with this (though I don't have much direct experience with it yet in Candela). As for ES6 and replacing jQuery usage, I can help with that if needed. In particular, I've figured out the delicate balance of configuration needed to do unit, integration, and coverage testing with a Webpack/ES6 codebase.
Maybe careful documentation could help with this. Also, if it's a niche use-case that leads to the confusion (namely, what I'm doing with Candela), then some kind of FAQ entry could easily cover the explanation of what's happening.
I'm still having trouble understanding when this might arise in this way. If I'm using jQuery in my page without knowing that, eg, GeoJS is using it internally, I'm not sure why an interaction between the two jQueries would arise in the first place. This is not to say I think it's impossible, I just have trouble picturing when it might happen.
I will take care of this forthwith. |
@jbeezley, @aashish24, what more should I do before I can remove the |
Webpack's code splitting is meant for use cases where you have a multipage web app. You can split out common things like vendor bundles that is shared between pages, and thus cached by the browser. It won't help in this case because that vendor bundle has to always be included with the application bundle, it can't fall back to anybody else's vendor bundle or to globals. For this purpose, code splitting would only result in requiring users of the library to include two files rather than one.
Any example I can think of seems kind of contrived. My unease is due to my experiences dealing with how different libraries and module bundles handle jquery specifically. Sometimes they try to be smart and attach to the global jquery object, sometimes they overwrite it, sometimes they try and merge them... My point isn't that what is done here is wrong, but that what is done elsewhere causes endless complications when there is more than one jquery on the page. It is a problem specifically for jquery because it is so ubiquitous and its design (specifically how you extend it via
That's not what I'm getting at. Take this for example, which is a rough approximation of what Meteor does (or used to do). Other bundlers may very well do something similar. // clone `window` somehow (I don't think this will actually work)
var copy = $.extend({}, window);
function block() {
// <-- your code bundle is inserted here
}
block.call(copy); In this case, As I mentioned though, I'm okay with this as is. I just want to make sure that it doesn't break existing use cases before merging. |
I more or less understand the concerns about the stuff you responded to. Basically, we'll just need to keep this in mind going forward and check whether it's involved with any weird behaviors we see in the future. I'm going to go ahead and remove the WIP label from this and wait for you to confirm that existing use cases will be ok. Thanks for your support on this! |
This works with Minerva, I'll go ahead and give it a LGTM. Thanks! |
FYI The selenium tests have started to fail this morning probably due to a firefox update. There aren't any problems with this branch. I'll look into it later today. |
Re moving away from jQuery for things like |
This change is enough to let Candela make use of GeoJS as a dependent library. However, I'm not sure how to test whether this breaks existing use cases (e.g., Minerva). Submitting this as a WIP PR mainly to have a discussion about it.