import Document, { Head, Main, NextScript } from 'next/document' import { renderStaticOptimized } from 'emotion/server' export default class MyDocument extends Document { static getInitialProps ({ renderPage }) { const page = renderPage() const styles = renderStaticOptimized(() => page.html) return { ...page, ...styles } } constructor (props) { super(props) const { __NEXT_DATA__, ids } = props if (ids) { __NEXT_DATA__.ids = this.props.ids } } render () { return (