Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#95 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
frontend

Research direction

Start in loadRemoteModule in apps/web-bundle/src/loader.js, where child imports are resolved with new URL(spec, url) against the requested URL rather than the response. Check the remoteCache lookup and the fetch response, and confirm how the .ts fallback is handled. Done means relative imports resolve against the final response URL and the cache is keyed by that URL, so a redirect and its target load once.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
5
Forks
2
Avg merge
1d 4h
Merged PRs (30d)
11

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MatAtBread/matbot

All issues in MatAtBread/matbot

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.