valerioageno / ssr-rs Goto Github PK
View Code? Open in Web Editor NEWServer side rendering on rust servers using the v8 engine for parse and evaluate the javascript code.
Home Page: https://docs.rs/ssr_rs
License: Apache License 2.0
Server side rendering on rust servers using the v8 engine for parse and evaluate the javascript code.
Home Page: https://docs.rs/ssr_rs
License: Apache License 2.0
Thanks for the project. Are you able to provide an example using Rspack? It is supposed to have equiv API to webpack, but I have been experimenting with various options, but can't seem to get the output configuration right for an IIFE variable entrypoint using the same output configuration from the webpack example configuration as a foundation. TBH the iife
output flag didn't make any difference when using named variable output. Here is a sample of the rspack output (I simplified the render function to simply return a string without React rendering):
var SSR;!function(){var e={512:function(e,t,n){"use strict";n.r(t),n.d(t,{Index:function(){return r}});var r=function(e){return'<!doctype html>\n <html>\n <head>\n <title>React SSR</title>\n <link rel="stylesheet" href="./styles/ssr.css">\n <\/script>\n </head>\n <body>\n <h1>React SSR</h1>\n </body>\n </html>'}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},SSR=n("512")}();
With all of my experiments, I received "failed to call function". Any pointers will be appreciated.
thanks for amazing work.
however, there are errors when runing example tide
the src:
...
async fn main() -> tide::Result<()> {
let mut app = tide::new();
app.at("/styles/*").serve_dir("client/dist/ssr/styles/")?;
app.at("/images/*").serve_dir("client/dist/ssr/images/")?;
app.at("/scripts/*").serve_dir("client/dist/client/")?;
app.at("/*").get(return_html);
app.listen("127.0.0.1:8080").await?;
Ok(())
}
...
It should be:
...
async fn main() -> tide::Result<()> {
let mut app = tide::new();
app.at("/styles/").serve_dir("client/dist/ssr/styles/")?;
app.at("/images/").serve_dir("client/dist/ssr/images/")?;
app.at("/scripts/").serve_dir("client/dist/client/")?;
app.at("/").get(return_html);
app.listen("127.0.0.1:8080").await?;
Ok(())
}
...
Hey @Valerioageno!
Thanks for your excellent package. Looks like the documentation and the README are a bit dated?
::new()
anymore?rusty_v8
is not used anymore and you're using v8
directly?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.