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

web-bundle: a redirected remote module resolves its imports against the requested URL

オープン 初心者向け
#95 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 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 の本文から書いたものです。

説明

bug

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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

MatAtBread/matbot のほかの issue

MatAtBread/matbot の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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