web-bundle: remote plugin imports are found by regex, so a computed import() is missed
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, node.js, typescript
- 領域
- frontend
調査の方向性
Start in apps/web-bundle/src/loader.js, where SPEC_RE finds imports and rewrites relative ones to blob URLs, then compare with apps/cli/remote-loader.js, whose header explains why resolving as the module system requests avoids the regex's failure modes. Reproduce a computed import(variable) of a sibling file in the browser and an import text inside a string or comment. Done means the browser loads both cases as Node does, but the fix needs a design choice between a real parse with sucrase and a service worker, so confirm the approach with the maintainer first.
索引モデルが issue の本文から書いたものです。
説明
What happens
In the browser, a remote plugin's computed dynamic import (import(variable)) of one of its own files fails, and an import inside a string, comment or template literal can be rewritten. The same plugin works on Node.
Why
apps/web-bundle/src/loader.js finds imports with a regex (SPEC_RE) and rewrites the relative ones to blob URLs before the module runs. A computed specifier is invisible to it and is left to resolve against the module's blob: URL, which cannot resolve a relative reference. The regex also cannot tell an import from the same text inside a string or comment.
Node stopped predicting the graph this way: apps/cli/remote-loader.js resolves each import as the module system actually requests it, and its header gives the regex scan's failure modes as the reason.
Notes toward a fix
The browser has no resolve hook for blob modules, so the options are a real parse (sucrase is already loaded for type stripping and can give import positions) plus a runtime helper for computed specifiers, or a service worker serving the plugin under its real URL so the browser resolves natively. The second would also fix root-relative imports and import.meta.url, at the cost of the in-memory, no-service-worker design.
Found while reviewing #93.
- 主要言語
- TypeScript
- スター
- 5
- フォーク
- 2
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 11
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MatAtBread/matbot のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
MatAtBread/matbot#99 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
MatAtBread/matbot#95 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
MatAtBread/matbot#94 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 半日 初心者へのやさしさ 66/100
MatAtBread/matbot#100 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
plugin add/remove: nothing records what an install created, so the undo and the uninstall both guess対応中かも @MatAtBread が今日担当しました。 オープンbug
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
MatAtBread/matbot#98 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
MatAtBread/matbot の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
one-zero-eight/apply-bot#39 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
bigbluebutton/bbb-ui-components-react#108 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
high priority
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
CI-CMG/deep-sea-corals-exb#84 · コメント 1 件 ·