Open bradleyretterer opened 8 years ago
Just ran into this issue myself.
index.js
and component.js
.index.js
files, i refer to ./component.js
In the second index.js, the first component.js gets referred. So indeed, it generates IDs based on string.
Can anyone confirm whether this affects both the CLI and the plugin? I can imagine that, when piped a bundle, the CLI may not have access to absolute path information (as default browserify
behavior is to resolve everything relative to a common directory). This may not be true for the plugin which would potentially have access to absolute file paths during bundling.
I'm able to reproduce it. It seems it's an issue for all api usages.
https://github.com/rreusser/bundle-collapser-uniqueness-failure
@substack Perhaps you can move this repo to the browserify
org. :)
They key seems to be identical file contents. If two files have the same contents, they seem to get flagged as dedupable. Bundle-collapsed browserify output's require
function then grabs one or the other and gets it wrong.
@rreusser Thanks for the code archaeology!
Say I have a node module
a
that hasrequire("../compiled/templates");
along with a node moduleb
that has its ownrequire("../compiled/templates");
- both pointing to their own respectivetemplates.js
file. When I use this on bundle-collapser, I get the same ID for both files, even though they're different files (i.e. they should have two different IDs). This leads me to believe that the ID generated is based off the uniqueness of the string, and not the full absolute path of the file that is required.