Anyone got any interest in messing around with running web frameworks (Next, Remix, Nuxt, SvelteKit, et. al) inside a component? I've been doing some rabbithole-spelunking today and it seems there are few hurdles. Wondering if there's other prior art that has been explored
@Lachlan Heywood the major thing here is bundling up the Node.js builtin shims, and that should get pretty far in the build system. It's still early days, but ideally we could even include Node.js compatibility layers by default, this and other compat will continue to improve over time in StarlingMonkey (https://github.com/bytecodealliance/StarlingMonkey), but it should be possible to get quite far with some build configs and some monkey patching.
Fission may have made some progress here I believe in this, but I haven't looked too closely at it - https://github.com/fission-codes/stack/blob/main/packages/homestar/src/wasmify/index.js
Thanks, @Guy Bedford! This is helpful. I think part of my problem is going to be that NextJS expects to be run by their CLI, and there's no clear entry point to create a component from. They have support for custom servers like express, but that configuration doesn't have support for server side functions, which is the majority of the reason for experimenting here. Vercel has their documented Build Output API (https://vercel.com/docs/build-output-api/v3) which is how cloudflare adapts next to run on Workers and I'm thinking this might be the next best router to investigate.
Last updated: Nov 22 2024 at 17:03 UTC