It's a little tricky to set up, because it expects the markup inside the root element to match what gets generated inside the worker. But Sapper could make it very easy.
Possible API:
import sirv from 'sirv';
import polka from 'polka';
import sapper from 'sapper';
import compression from 'compression';
import { manifest } from './manifest/server.js';
polka() // You can also use Express
.use(
compression({ threshold: 0 }),
sirv('assets'),
- sapper({ manifest })
+ sapper({
+ manifest,
+ workerdom: true
+ })
)
.listen(process.env.PORT)
.catch(err => {
console.log('error', err);
})
One significant hurdle: you can't prevent event defaults. The client-side router depends on being able to intercept clicks on <a> elements, and prevent the default if it's to a URL belonging to the app.
This project is very interesting:
It's a little tricky to set up, because it expects the markup inside the root element to match what gets generated inside the worker. But Sapper could make it very easy.
Possible API: