Server Side Rendering without Next

Hi, I am interested in developing a non-nextjs approach to server side rendering. I have built an example repo available here with the bare minimum amount of code.

Steps to create:

  • built with $ expo init
  • add in react-naviation
  • update App.js with example navigation (hello-react-navigation)
  • add AppEntry.js
  • add server.js with express server to serve expo build:web output
  • add render.js server side render function
  • add webpack.server.js build process for render

Unfortunately, calling render results in a error.

const render = require(‘./web-build/render’).render raises:

$ node server
/Users/tyrauber/Sites/expo-ssr/node_modules/react-native-web/dist/exports/View/index.js:10
import * as React from 'react';
^^^^^^

SyntaxError: Cannot use import statement outside a module

Solution is probably figuring out how to associate react in the exported render function with the node react module.

Any ideas would be appreciated.