Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Dedupe regression with browserify v8

Aperta
#51 19 commenti 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
build-system

Direzione di ricerca

Riproduci lo scenario di deduplicazione con factor-bundle e browserify 8.0.0, confrontando il bundle A generato con l'output di browserify v7 mostrato qui. Traccia il modo in cui il bundle comune e il bundle A fanno riferimento agli ID dei moduli 100 e 200. Il lavoro è completato quando il modulo deduplicato viene caricato senza il TypeError riportato, preservando al contempo il caso con dipendenze distinte.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 A depends on module B
  • Other modules depend on module B', which is identical to B but a separate copy exists for whatever reason
  • B is deduped by browserify and points to B'
  • B gets routed to the A bundle, assigned ID of 200
  • B' gets routed to the common bundle, assigned ID of 100
  • Page includes common bundle then A bundle

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.

Lingua principale
JavaScript
Stelle
397
Fork
24
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di browserify/factor-bundle

Tutte le issue di browserify/factor-bundle

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.