-
Notifications
You must be signed in to change notification settings - Fork 96
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
multi-bundle fails to resolve peer dependencies #73
Comments
Interesting. Possibly this is a bug in the version of browserify that is on the server? @substack @maxogden |
If typeahead.an requires an to function then it should be a dependency and On Friday, March 28, 2014, Joshua Holbrook notifications@github.com wrote:
|
sorry the for terseness, I was on my phone earlier. I believe this is a misunderstanding of how peerDeps are supposed to be used. feel free to re-open if I'm wrong |
As discussed here: max-mapper/requirebin#45 this issue is not about code style, but about parity with npm+browserify. if module A has module B as a peerDependency, and it require()'s B, it will work in a normal environment, with npm and browserify. There are two different arguments:
|
Unfortunately, due to issues like facebook/react#2402, it is often necessary for plugin authors to put I understand what people are trying to do with making peerDependencies stricter but it appears we're caught between a rock and a hard place with this one. Damned if we put it in dependencies, and damned (in terms of compat with projects like this) if we don't. If browserify-cdn installed peerDependencies it would be a big help. It is the npm 2.x behavior so it is technically "correct", even if the auto-installation (but not peerDependencies) will be deprecated in npm 3. For a service like this which should just be trying to compile the module as best it can, it makes sense to install these deps. |
It's also a wontfix |
@jfhbrook is this happening because of npm v3 on wzrd.in server? |
I will just leave it here for some time https://github.com/jfhbrook/wzrd.in/blob/master/bundler/install.js#L12 |
We're currently using npm@2. |
@jfhbrook hmm, so I don't understand why peer deps are not installed then.. |
@jfhbrook I just investigated this issue a bit and found that |
@maxogden So... is this an issue with browserify? because it's clear that In all fairness to the lib devs that use
What's clear about the quote is that the plugin with the peerDependency will not work without the peerDependency being installed along side it. What's also clear is that npm1 and 2 will auto-install this dependency (and npm3 will give a warning). What isn't clear is whether or not a module import could fail if the peerDependency isn't installed. Some interpret that it could, other's don't, and it isn't clear who is right. But if it isn't explicitly mentioned in the docs, then it's not unreasonable to assume that the module import could fail without it's peerDepedency installed. And if I had to guess one practical reason (interpretations aside) why these libs (like motorcyclejs and cyclejs) use peerDependency in this way, is because npm1 and 2 will not try to flatten the dependency tree. But ambiguity aside, I do think that |
wzrd.in ultimately uses npm to install and bundle. Anything you're seeing here is a consequence of where the code is placed inside an install tree when browserifying. EDIT: In the case of multibundles, we build each dependency separately. This is probably the source of a few of your problems. If you can find a way to make peerDeps Just Work, then by all means. To me, it's such an antipattern that I don't even really care. |
I think that might be the source of the problem. Why is it bundling each dependency separately? Regardless of whether or not you think it's an antipattern (I agree that it is), it should be consistent with how npm + browserify works locally if it's calling itself browserify as a service. More specifically, what commands is wzrd.in running that makes the following fail but works when doing it locally? {
"dependencies": {
"@motorcycle/core": "^1.2.0",
"@motorcycle/dom": "^1.3.0"
}
} $ npm install
$ ./node_modules/.bin/browserify -r @motorcycle/dom -t [ babelify --presets [ es2015 ] ] -s DOM -o dom.js ^ works locally ^ |
I told you--- @motorcycle/core and @motorcycle/dom are built with entirely different builds, because multibundles code is just a convenience layer on top of singular bundles. Changing this would involve a large refactor and probably breakage. If you want to take a crack at fixing it, go nuts. |
Ugh.. oh well. That's a real bummer but I guess it is what it is... I'm not sure I would go through the trouble of supporting peerDependency if it's not a small fix either. I posted an issue on their side so hopefully they'll get rid of the peerDependency and I don't have to resort to hacks. |
I noticed browserify cdn is failing to resolve peer dependencies, even when they are part of multi-bundle.
E.g.:
This gives me:
Here
typeahead.an
hasan
as a peer dependency.The text was updated successfully, but these errors were encountered: