Async SSR Magic?
Trying to get Async SSR working in my project, I'm using esbuild. Working on troubleshooting and I found this lovely text box on the SSR docs page: "Keep in mind that you will need a bundler like Vite, Webpack, or Rollup to bundle your application. Here's a fully functional example using rollup and express. solid-ssr-workbench. This repo contains examples of all 3 forms of SSR."
I dove into the example repo provided, the only difference I could find between a typical solid config and this one was this line:
presets: [["solid", { generate: "ssr", hydratable: true, async: true }]]
So there's an async
option for the solid babel preset! I dropped this into my esbuild object with plugins: [solidPlugin({ solid: { generate: "ssr", hydratable: true, async: true } })]
but things still aren't working. I also tried creating a bespoke version of esbuild-plugin-solid with the newest babel-preset-solid from NPM included. Still, no dice.
Is it truly the case that I MUST switch to a fat bundler to get async SSR working? There's gotta be a way to get the rendering working outside of Vite, Rollup or Webpack.6 Replies
expirimenting with rollup, seems like the
async
flag in the solid preset does nothing. The compilation result doesn't change regardless of that flag. Which makes sense, I couldn't find anything in the jsx transform plugin that honored that.there is no magic, the docs are wrong. Working esbuild with async ssr: https://github.com/only-cliches/solid-ssr-workbench/tree/esbuild
GitHub
GitHub - only-cliches/solid-ssr-workbench at esbuild
Contribute to only-cliches/solid-ssr-workbench development by creating an account on GitHub.
you can actually do this with just esbuild. My first SSR experiment used only esbuild, however the dev environment is just so bad I abandoned it.
The idea here is to build a server and a client bundle
Async having different compilation is ancient. I haven't updated something in a while.
I dropped in a PR to update the SSR example, it was over 2 years old! https://github.com/ryansolid/solid-ssr-workbench/pull/4
GitHub
Updated Dependencies & Necessary Code Changes by only-cliches · Pul...
This repo is referenced in the modern SolidJS docs: https://docs.solidjs.com/references/concepts/ssr/async-ssr
The example hasn't been updated in a few years, it was using the depreciated solid...
Thanks