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

Supporting SSR scenarios

Aperta
#460 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp, node.js, react, typescript, vite
Ambito
backend, web-dev

Direzione di ricerca

Inizia esaminando il prototipo collegato, in particolare il suo init.js con patch, NodeSsrHost.cs e vite.config.ts, insieme alle issue #440 e #330. Chiarisci se il contributo previsto consiste nel fornire un supporto SSR riutilizzabile per un host CLR già inizializzato, nella riscrittura degli import in fase di build o in entrambe le cose; done deve essere definito da un design accettato e da una copertura SSR funzionante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

One of my motivations to use this is for using my .NET server as a runtime for my React frontend. In order to do that, I need to execute SSR code through Node.js in .NET and I think the two options right now are edge-js and node-api-dotnet.

I've completed a prototype of supporting React Router SSR with node-api-dotnet here:

https://github.com/kamranayub/dotnet-ssr

However, I did run into a few issues:

  • Debugging doesn't work, since it's targeting net8.0 and there's an issue with that #440
  • You can't use the node-api-dotnet npm package vanilla within SSR context because the CLR host is already initialized #330

For the second issue, I've worked around it by patching the init.js manually and injecting a dotnetHost global, which works!

https://github.com/kamranayub/dotnet-ssr/blob/be9dc260c5cc23c31f037cc60e74872c7fd8d30a/web/patches/node-api-dotnet%2B0.9.15.patch

https://github.com/kamranayub/dotnet-ssr/blob/be9dc260c5cc23c31f037cc60e74872c7fd8d30a/src/server/NodeSsrHost.cs#L57-L71

I think this could be contributed back to the library, but not sure where/how to do that. I'm up for it if that would be accepted, I just need some guidance.

I haven't yet prototyped this with edge-js, I only know it also does in-proc communication -- what I don't know is if I can set it up like this so the SSR code can invoke .NET APIs, plus I love that this generates the typedefs which make this work great under Vite dev mode 🚀

To get that working, you need to rewrite the import paths at build time:

https://github.com/kamranayub/dotnet-ssr/blob/be9dc260c5cc23c31f037cc60e74872c7fd8d30a/web/vite.config.ts#L12-L65

Lingua principale
C#
Stelle
783
Fork
80
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

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 microsoft/node-api-dotnet

Tutte le issue di microsoft/node-api-dotnet

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.