Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
accept custom resolve function #1441
Conversation
|
Interesting approach @Cactusbone. I've been thinking about a good way to solve that (allow setting it, but also wrapping the original). Part of the issue for me is that I wish to be able to do it from a plugin. |
|
from what I understood, plugins can interact only after modules_deps right now, so it's not gonna be easy :) |
|
@Cactusbone That's true. It could be as simple as just documenting |
|
.resolver did not do the trick for me, since it still required existing files and i wanted to give arbitrary code. |
|
@Cactusbone I'm not sure what you mean. Wrapping |
|
@Cactusbone I understand what you're going for, I'm just not sure what difference there would be between what you've PR'ed here and this: var b = browserify();
var mdeps = b.pipeline.get("deps").get(0);
var baseResolve = mdeps.resolver;
mdeps.resolver = function (id, parent, cb) {
customResolve(id, parent, function (err, file, pkg) {
if (!err && !file) return baseResolve(id, parent, cb);
else return cb(err, file, pkg);
});
};In your PR (Please note that I'm not necessarily saying your proposal shouldn't be considered -- there's a couple of different issues involved here.) |
|
@jmm looks like my memory was playing against me. indeed using a customResolver here do work as well as my PR :) |
|
@Cactusbone Ok, thanks for the feedback. I personally do think there should be public API for using a custom resolver eventually -- I would just want to see it have a sensible API (including being able to set it via plugin, for example). |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

custom resolve function which default to internal resolve when not found.
allows to easily plug in some files.
not far from #1006 though
along with module_deps fileCache, can be used to provide generated content for #1436