You could probably go the Stackblitz
You could probably go the Stackblitz route? Only thing there is you can’t run dev there
3 Replies
hey HardlyWorkin! Thanks for the response.
Initially I was going to use sandpack (codesandbox) – but typescript support and actually deploying to preview changes seemed to work pretty well (esp. to make sure what they build fit into how I intend to RPC to them via my dispatch worker)
would you mind ellaborating on what'd be the stackblitz route? e.g. iframing/embeding their editor SDK and being able to get a built output programmatically?
Gotta admit that if somehow I can run
wrangler deploy --dry-run --outdir dist
– it'll be a much safer path to pursuethat's pretty interesting
using https://developer.stackblitz.com/platform/api/javascript-sdk-vm#getfssnapshot you can embed an SDK with files you declare, run the build on changes like
"start": "chokidar 'src/**/*.{js,ts,jsx,tsx}' -c 'pnpm run build' --debounce 1000 --initial",
and then use await vm.getFsSnapshot()
to get the contents of dist/**
and upload that to the worker for platforms API
(you can do much fancier things with the Web Container API but looks like you require licensing for commercial usage)