web-bundle: remote plugin imports are found by regex, so a computed import() is missed
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js, typescript
- Ambito
- frontend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 5
- Fork
- 2
- Merge medio
- 1g 2h
- PR unite (30g)
- 12
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MatAtBread/matbot
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MatAtBread/matbot#95 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
MatAtBread/matbot#94 ·
I maintainer di solito rispondono entro 1 giorno
-
http: let a header value come from the Vault, so a keyed API needs no secret in the conversationApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
MatAtBread/matbot#104 ·
I maintainer di solito rispondono entro 1 giorno
-
http: ToolContracts arm duplicates HttpInput inline — named references now expand on the wireAperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 66/100
MatAtBread/matbot#100 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
MatAtBread/matbot#65 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MatAtBread/matbot
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
juice-shop/juice-shop#3686 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
dsh-market/dsh-market#877 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
ScottKirvan/GOMAC#61 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
stellar/stellar-dev-skill#151 ·
I maintainer di solito rispondono entro 1 giorno