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

web-bundle: remote plugin imports are found by regex, so a computed import() is missed

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

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

説明

bug

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

はじめの一歩

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

MatAtBread/matbot のほかの issue

MatAtBread/matbot の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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