Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Browserify includes required from modules defined as external #401
(Transitive dependency in this context means module A requires module B, and module B requires module C. Hence, module C is a transitive dependency of A).
When module A has a transitive dependency only module C through module B which is external (not included), browserify still includes that dependency (C).
I think it should be expected from the external bundle to include those dependencies, instead of having to manually externalize each of them.
I have included an extension of the docs example (beep, boop, robot) for what I mean at https://gist.github.com/amitayd/5580837 .
I believe the expected behaviour including only beep.js.
I only had a brief look at the code base so i might be entirely wrong, but it seems that the list of files and their dependency is gathered from module-deps for all required files, and the returned list does not include the origins/requiree(s) of the dependency, so it's a problem to filter them in browserify.
One solution is to pass the externals filter to be used by module-deps when walking the dependencies.
Another is the module-deps can return something like origin modules array for each row, then browserify can work like this:
I contributed a patch to the module deps system recently, so I have some familiarity with it.
so, exclude works by filtering out the modules that module-deps finds, but if you used the filter option, you should get the behaviour you desire.
See how mdeps is piped to https://github.com/substack/node-browserify/blob/master/index.js#L206
Thank you for your input, dominictarr.
So I understand I can create and pass a filter function that would make use of self._external to filter out external deps. Can anyone think of a reason why transitive dependencies shouldn't be excluded?
If passing opts.filter to bundle() should be supported I can do something like returning "original_filter (if exists) OR externalfilter".
referenced this issue
Jun 15, 2013
I'm also interested in this fix. I haven't looked into module-deps, but it seems like the resulting bundled file has the dependencies of each file listed beneath it (like