SolidJS: Manually using SSR with v8?
Hi,
I am working on a project which has a PHP back-end, but which has access to a PHP V8 (https://github.com/phpv8/v8js) module, which means I can perform some sort of SSR behind-the-scenes and render the HTML/javascript before the page load- I'm curious if that is at all possible to accomplish using basically just V8 and solidjs in this way?
I mean, I can use
renderToString
to extract the HTML, but I also need to generate and render the javascript which accompanies my page, in order to allow it to be interactive.
Does anybody have any ideas here?
Thanks!GitHub
GitHub - phpv8/v8js: V8 Javascript Engine for PHP — This PHP extens...
V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine - GitHub - phpv8/v8js: V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
7 Replies
I believe the most reasonable approach (and what solid-start does) is
Use a build step to generate two bundles:
ssr bundle
client bundle with hydration
then, call the ssr bundle from phpv8, and also have php serve the client bundle
ooooh okay
I'll have to take a deeper look into start-solid
If I have any questions, I'll continue posting here 😁
so what does the ssr bundle do?
is it hydration support? like do I need any special routing or anything?
https://docs.solidjs.com/references/concepts/ssr/simple-client-fetching-ssr
https://www.solidjs.com/guides/server
SolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
Thank you!
So the PHP node extension generates the page state, which hydrates the client javascript
It's doing more than just generating state, it is creating a string representation of the client dom
Aaaaah!!
Hmmm, I need to work on porting that to vite lol
so how do I convert the rollup config to vite?