Export ESM
Nessuno ha ancora preso questa issue.
- #522 di @petyosi — chiusa senza merge
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, nodejs, vite
- Ambito
- build-system, developer-experience, web-dev
Direzione di ricerca
Inizia esaminando l'entry UMD corrente, la build per browser dist/js_min/getstream.js e la configurazione del pacchetto npm, quindi riproduci l'import con Node.js 16 e Vite. Il lavoro è completato quando un export ESM ottimizzato per il browser può essere importato dal pacchetto installato localmente senza riscrivere l'import tra le build di sviluppo e produzione di Vite.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
getstream is currently exported as UMD only. ESM support has been around in NodeJS (and the browser) for some time and, I believe, since v12.20 it can be used without a flag. With NodeJS 16 being LTS at the time of this writing, I think it would be nice to provide an ESM export. The main advantage (for me, anyway) would be to use the same syntax when importing from a CDN and node_modules, rather than using a global variable.
Further reading:
- https://medium.com/swlh/npm-new-package-json-exports-field-1a7d1f489ccf
- https://blog.sindresorhus.com/get-ready-for-esm-aa53530b3f77
- https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
While I don't want to get too specific on my own code, I would like to provide an example where this would help developers. When using Vite's development server, I can't import getstream from without running into NodeJS-specific problems (this issue is possibly related). The same import works fine when Vite builds my code and optimizes it for the browser. Currently, my only workaround is to change the import from import stream from "getstream" to import "https://cdn.jsdelivr.net/npm/[email protected]/dist/js_min/getstream.js". However, I need to undo this change whenever I build, since I want to import the locally installed npm package of getstream. If you provided an (browser-optimized) ESM, I could simply put a condition on NODE_ENV in my config file (example below), not rewriting my import on every switch between development and build.
resolve: {
alias: {
"getstream": process.env.NODE_ENV ? "https://cdn.skypack.dev/getstream" : "getstream"
}
}
- Lingua principale
- JavaScript
- Stelle
- 337
- Fork
- 114
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
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 GetStream/stream-js
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
Tutte le issue di GetStream/stream-js
Issue simili
-
🐞 bug pending triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
CircuitVerse/CircuitVerse#8025 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
schmayterling/hibi#245 ·
I maintainer di solito rispondono entro 1 giorno
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
vercel/ai#23304 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug package:vitest
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
cloudflare/workers-sdk#16255 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Proxy and MCP URLs with an empty authority parse as a different hostForse già presa @ericcaiwx-star l’ha presa oggi. Apertaclawsweeper:bulk-filed clawsweeper:linked-pr-open clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
openclaw/openclaw-enterprise#2384 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno