4 ms·
It’s a bit unfortunate that no SSR-supporting libraries and frameworks in JavaScript seem to allow the final website to be built in a pure standards-compliant E
by strogonoff 3y ago
It’s a bit unfortunate that no SSR-supporting libraries and frameworks in JavaScript seem to allow the final website to be built in a pure standards-compliant ES runtime. You have to bring in the entire Node or Deno because everything tends to be hard-coded to depend on the filesystem and other non-standard APIs.
- ricardobeat 3y agoThat used to be easy with Svelte 3, but later versions got node APIs more intertwined with the code, + a lot of useful features live in SvelteKit.
- csjh 3y agoHow do you mean? Svelte 4 and 5 don't use any node-specific APIs for SSR
- afavour 3y agoagreed. I once played around with the idea of a framework that rendered server-side then immediately registered a service worker that would perform all subsequent renders on-device. It did work but there were enough rough edges with compatibility that I never got anywhere concrete with it.
- throwitaway1123 3y agoThe VC funded JS startups have no incentive to promote this, but you can still just call renderToString in any ES runtime to SSR your React components. There's definitely more boilerplate to deal with, but you could easily get away with doing SSR in a lightweight runtime like QuickJS.
- strogonoff 3y agoThat is technically correct. I guess I’m just being lazy.
- yencabulator 3y agoNot sure if you really meant "build" as in build time there or not. SvelteKit server-side runs happily on e.g. Cloudflare Workers which is just V8 + Web APIs, and definitely not Node or Deno. Generating the files to deploy to a Cloudflare Worker still needs NodeJS.