Dedupe regression with browserify v8
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- build-system
Research direction
Reproduce the deduplication scenario with factor-bundle and browserify 8.0.0, comparing the generated A bundle with the browserify v7 output shown here. Trace how the common bundle and A bundle reference module IDs 100 and 200. Done means the deduped module loads without the reported TypeError while preserving the distinct-dependency case.
Written by the indexing model from the issue text.
Description
I'm logging the issue here, but the error is due to changes in browserify 8.0.0.
This might be best explained with an example:
- Module
Adepends on moduleB - Other modules depend on module
B', which is identical toBbut a separate copy exists for whatever reason Bis deduped by browserify and points toB'Bgets routed to theAbundle, assigned ID of200B'gets routed to the common bundle, assigned ID of100- Page includes common bundle then
Abundle
A bundle in browserify v7:
200:[function(require,module,exports){
module.exports=require(100)
},{"dup":100}]}
A bundle in browserify v8:
200:[function(require,module,exports){
arguments[4][100][0].apply(exports,arguments)
},{"dup":100}]}
This results in an exception Uncaught TypeError: Cannot read property '0' of undefined because ID 100 is not defined in the current bundle.
This worked in v7 because it used require, which tries to resolve the module with previously defined requires from other bundles.
I realize this is an edge case and that if npm is correctly deduping dependencies, this situation should not occur. And the v8 behaviour is more correct in theory because B may have different dependencies from B'. However, assuming that any module is defined in the current bundle is dangerous when factor-bundle is involved.
- Dominant language
- JavaScript
- Stars
- 397
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from browserify/factor-bundle
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
browserify/factor-bundle#95 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
browserify/factor-bundle#94 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
browserify/factor-bundle#92 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
browserify/factor-bundle#83 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
browserify/factor-bundle#82 · 3 reactions ·
All issues in browserify/factor-bundle
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100
-
Issue-Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
sugarlabs/musicblocks#8924 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ArduPilot/ardupilot_wiki#8088 ·
-
[BUG] createTool tools cannot be registered with Mastra when exactOptionalPropertyTypes is enabled Opencustomer-eng status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100