How to run Inferno JSX on server?

92 Views Asked by At

I am trying to use Inferno to render on the server. The documentation inferno-server and server-side-rendering does not say show to set-up babel & run the sever.

All I could find is InfernoJS Babel Plugin but noting about running it on Node.

Any help would be appreciated.

1

There are 1 best solutions below

0
On

Could you explain what you mean by "Running on node"?
Inferno Babel plugin converts the JSX code into a regular JS code, which runs without problems on node (the server uses renderToString). While you are not using browser elements (document and other tools), everything should be fine. Then you need to make a separate component for the client, which when requested will be given as a bundle along with the html page, and then using hydrate function to "cling" into webpage and bind items.

you can check my repository (although this is for TypeScript): https://github.com/MrFoxPro/inferno-isomorphic-tempalte