import path from 'path' import React from 'react' import ReactDOMServer from 'react-dom/server' import express from 'express' import { getLoadableState } from 'loadable-components/server' import App from './App' const app = express() app.get('/', async (req, res) => { try { const reactApp = const loadableState = await getLoadableState(reactApp) const html = ReactDOMServer.renderToString(reactApp) res.send(`
${html}
${loadableState.getScriptTag()} `) } catch (err) { res.status(500) res.send(err.stack) } }) app.listen(3000, () => console.log('http://localhost:3000'))