Adds single-pass prerendering via a new prerender-loader

This commit is contained in:
Jason Miller
2018-04-17 14:04:55 -04:00
parent be8fae10f8
commit 3ba0a5a22a
6 changed files with 218 additions and 73 deletions

View File

@@ -4,7 +4,7 @@ import './style';
import App from './components/app';
// Find the outermost Element in our server-rendered HTML structure.
let root = document.querySelector('[prerender]') || undefined;
let root = document.querySelector('#app') || undefined;
// "attach" the client-side rendering to it, updating the DOM in-place instead of replacing:
root = render(<App />, document.body, root);
@@ -26,7 +26,7 @@ if (process.env.NODE_ENV === 'development') {
});
}
/** @todo SSR */
// if (typeof module==='object') {
// module.exports = app;
/** @todo Async SSR if we need it */
// export default async () => {
// // render here, then resolve to a string of HTML (or null to serialize the document)
// }