Closed jgoz closed 10 years ago
@substack, @terinjokes I'm only checking for row.dedupeIndex
here rather than that and row.dedupe
, because browserify only looks at dedupeIndex
. Thoughts on that choice?
This seems like a fine choice until we get some failing tests indicating otherwise. Merged in 2.1.3. Thanks for the patch!
Only thing I can think of is that deps-topo-sort
only looks at the deps
field so it's possible that other module had already been written out to a stream. Trying to come up with a failing case to see if it's possible.
I shuffled around the dependencies and indexes, and wasn't able to come up with anything failing. Will keep eyes peeled for a failing report.
:+1:
Thanks @terinjokes. I'll try to come up with a test case for that scenario because I think it's valid (though probably rare). You might be able to handle it by adding transform streams before and after deps-topo-sort that insert (and later remove) a fake dep
entry for deduped rows.
I ended up just faking it just by editing the orders of the ROWS. Can probably push a commit that makes it part of the test suite.
K, I think we should handle it - I'll give you an empty branch for your commit, then I'll do the fix.
Actually, you can just push it to support-dedupe
on my fork. You should be a collaborator.
If a deduped row is factored into the common bundle, the target row should also become common.
This can cause an issue when the same dependency can be resolved to multiple paths, but only one of them becomes common.
A concrete example would be with using
assert
andutil
in your web project. Theassert
module is pinned to an outdated version ofutil
, whereas browserify uses the latestutil
, resulting inassert/util
andutil
being extracted to node_modules. Code that usesassert
will transitively use the outdated version ofutil
, which browserify can dedupe to its actualutil
. But ifassert/util
is used multiple times whenutil
is only used once, a runtime error is thrown because theassert/util
dependency onutil
is not available in the common script.This fixes that :)