S
SolidJS17mo ago
robert_

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
milomg
milomg17mo ago
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
robert_
robert_OP17mo ago
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?
milomg
milomg17mo ago
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.
robert_
robert_OP17mo ago
Thank you! So the PHP node extension generates the page state, which hydrates the client javascript
milomg
milomg17mo ago
It's doing more than just generating state, it is creating a string representation of the client dom
robert_
robert_OP16mo ago
Aaaaah!! Hmmm, I need to work on porting that to vite lol so how do I convert the rollup config to vite?
Want results from more Discord servers?
Add your server