Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Dedupe regression with browserify v8

オープン
#51 コメント 19 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
build-system

調査の方向性

factor-bundle と browserify 8.0.0 で重複排除のシナリオを再現し、生成された A bundle とここに示す browserify v7 の出力を比較します。共通 bundle と A bundle がモジュール ID 100 および 200 をどのように参照しているかを追跡します。報告された TypeError が発生せずに重複排除されたモジュールが読み込まれ、異なる依存関係のケースが維持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
JavaScript
スター
397
フォーク
24
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

browserify/factor-bundle のほかの issue

browserify/factor-bundle の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。