web-bundle: a redirected remote module resolves its imports against the requested URL
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
- 領域
- frontend
調査の方向性
apps/web-bundle/src/loader.js の loadRemoteModule から始めてください。ここでは子インポートが、レスポンスではなく要求された URL を基準に new URL(spec, url) で解決されています。remoteCache の検索と fetch のレスポンスを確認し、.ts フォールバックがどのように扱われているかも確かめてください。相対インポートが最終的なレスポンスの URL を基準に解決され、キャッシュがその URL をキーとするようになれば完了です。これにより、リダイレクトとそのリダイレクト先は一度だけ読み込まれます。
索引モデルが issue の本文から書いたものです。
説明
What happens
If a remote plugin's module is served by redirect, the browser resolves that module's relative imports against the URL that was requested rather than the one that answered, so they fetch the wrong paths.
Why
loadRemoteModule in apps/web-bundle/src/loader.js resolves children with new URL(spec, url), where url is the URL it asked for (or its .ts fallback), never res.url. A redirect is common on CDNs, e.g. unpkg answers https://unpkg.com/lit@3?module from https://unpkg.com/[email protected]/index.js?module=, and ./x.js from that file belongs under [email protected]/, not at the host root.
remoteCache is also keyed by the requested URL, so two URLs that redirect to one module load it twice.
Notes toward a fix
Resolve children against res.url, and key the cache by it, so a redirect and its target share one module. This matches how the browser treats a module it loads natively, and how Node resolves a URL import on the remote-url-identity branch.
Raw GitHub, the usual plugin host, does not redirect file requests, so this mostly affects plugins served from a CDN.
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時間 初心者へのやさしさ 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 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
MatAtBread/matbot#96 ·
メンテナーはふだん 1 日以内に返信
MatAtBread/matbot の issue をすべて見る
似ている issue
-
Create/import wallet form shows raw "password must be at least 1 characters" instead of the translated message対応中かも @CapThunder19 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
joinmarket-webui/jam#1538 ·
メンテナーはふだん 1 日以内に返信
-
t0ggles
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
nolimits4web/swiper#8240 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
modelcontextprotocol/inspector#2723 ·
メンテナーはふだん 1 日以内に返信
-
status:approved type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信