Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Export ESM

Aperta
#501 6 commenti 6 reazioni 0 assegnatari Vedi su GitHub

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

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:

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GetStream/stream-js

Tutte le issue di GetStream/stream-js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.