The drawback is that things like feature branches are more difficult to use. For example, with npm you need to resort to various scripts or handle them by yourself manually.
Re:Mastering Git submodules
by jessaustin on Friday February 20, 2015 @12:17PM
(#9081439)
You're right, but in general I don't think any npm module ought to depend on a feature branch of another npm module. If a feature is worth keeping around, it's worth publishing (even if only to your private npm repo). If 19 different projects want 19 different behaviors from the module.foobar() function, then split the function up or pass it flag parameters or whatever, but don't keep 19 different versions of the code floating around. Pain is inevitable in that scenario. Of course while you're developing a new feature you might want to use it from another module on your dev machine, but "npm link" is what you want to use for that.
>Of course while you're developing a new feature you might want to use it from another module on your dev machine, but "npm link" is what you want to use for that.
Yeah, but that's the manual way. It works okay when you're only developing a small number of modules (say 1 to maybe 3), but at some point doing it manually becomes pretty annoying. And you need scripts and commits to package.json files if you have a build server which makes builds of feature branches.
On the other hand, if the technological context allows for packaging and formal dependency management, you should absolutely go this route instead: it lets you better split your codebase, avoid a number of side effects and pitfalls that litter the submodule space, and let you benefit from versioning schemes such as semantic versioning (semver) for your dependencies.