Thanks for the great module!
I got caught out by this when using a monorepo set up:
|
// browserify is clever about deduping modules with the same source code, |
|
// but it needs the browser-pack runtime in order to do so. |
|
// we don't have that runtime so this … re-dupes those modules. |
|
if (dedupedRx.test(row.source)) { |
|
var n = row.source.match(dedupedRx)[1] |
|
var dedup = rows.filter(function (other) { |
|
return String(other.id) === n |
|
})[0] |
|
row.source = dedup.source |
|
} |
Vanilla browserify was able to successfully dedupe because even though the paths were different, the content was the same, but this process discards that and so you end up with n copies of a dependency in a bundle where n is the number of times it exists on your file system.
I'm assuming arguments[4] is the require() function from the module wrapper? Is it possible to figure out which module it is requiring, put a placeholder to that module in and then reference it by its eventual variable name? e.g. _$validators_14.
Happy to figure out how to PR this but I want to check there wasn't a reason this was avoided in the first place. Cheers!
Thanks for the great module!
I got caught out by this when using a monorepo set up:
browser-pack-flat/index.js
Lines 41 to 50 in 77cafd3
Vanilla browserify was able to successfully dedupe because even though the paths were different, the content was the same, but this process discards that and so you end up with
ncopies of a dependency in a bundle wherenis the number of times it exists on your file system.I'm assuming
arguments[4]is therequire()function from the module wrapper? Is it possible to figure out which module it is requiring, put a placeholder to that module in and then reference it by its eventual variable name? e.g._$validators_14.Happy to figure out how to PR this but I want to check there wasn't a reason this was avoided in the first place. Cheers!