web-bundle: a redirected remote module resolves its imports against the requested URL
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu từ loadRemoteModule trong apps/web-bundle/src/loader.js, nơi các import con được phân giải bằng new URL(spec, url) dựa trên URL được yêu cầu thay vì phản hồi. Kiểm tra lượt tra cứu remoteCache và phản hồi của fetch, đồng thời xác nhận cách xử lý phương án dự phòng .ts. Công việc hoàn tất khi các import tương đối được phân giải dựa trên URL phản hồi cuối cùng và cache được khóa theo URL đó, để một chuyển hướng và đích của nó chỉ được tải một lần.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 5
- Fork
- 2
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MatAtBread/matbot
-
http: ToolContracts arm duplicates HttpInput inline — named references now expand on the wireĐang mởfuture-enhancement
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 66/100
MatAtBread/matbot#100 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
future-enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
MatAtBread/matbot#65 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của MatAtBread/matbot
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
melgarafael/DeskcommCRM#3000 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
callstackincubator/simlock#639 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
aws/agentcore-cli#2606 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 [BUG] - FeatureComparisonTable text-only cells are top-aligned while icon cells are centeredĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 7 ngày
-
ai-driven-qa bug Cosmetic
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày