A Server-side rendering (SSR) demo for scalajs-react, based on https://blog.shipreq.com/post/scala_react_and_ssr_part_1
- Package sjs code:
scala-cli --power package WebPageJs.scala -o js/webpage.js -f
- Run server code:
scala-cli WebServerJvm.scala
Let's suppose we want to pick react 16, we'll download the dependencies through npm like this:
npm install react@^16.5.2
npm install react-dom@^16.5.2
Then, grab the minified js code:
cp node_modules/react/umd/react.production.min.js js
cp node_modules/react-dom/umd/react-dom-server.browser.production.min.js js
NOTE: The umd
variant is the one that works.