ionic-team / ionic-team/rollup-plugin-node-polyfills

Default "include" option fails for monorepos

オープン
#17 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
142
フォーク
65
PR マージ指標
30日以内にマージされた PR はありません

説明

[heavily edited to match what the source of the bug is]

The default `include` option that’s passed to `rollup-plugin-inject`, `'node_modules/**/*.js'`, causes problems when working in a monorepo where `node_modules` dependencies are hoisted above the current working directory where `rollup` is run.

The `include` ends up getting resolved relative to the current directory, even though the Node resolution might find modules in a `node_modules` directory in a parent.

For me, this manifested in the `buffer-es6.js`’s `global` not getting converted into its own polyfill, which caused an `Uncaught ReferenceError: global is not defined` error.

A workaround is to manually specify an `include` option to the `rollup-plugin-node-polyfills`.

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

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

調査の方向性

まず、rollup-plugin-node-polyfills から rollup-plugin-inject にデフォルトの include オプションがどのように渡されるかを追跡し、次に依存関係が hoisted される monorepo でその動作を再現します。デフォルト処理によって hoisted された依存関係が見つかり、include オプションを手動で指定しなくても buffer-es6.js のグローバル参照が変換されれば完了です。

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

評価

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

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

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