02e75cfdd1
## Changelog - Removed react-lazyload - Removed images - Removed ReactDOMServer from Client - Removed next.config.js ## Notes **CommonJS vs ESM:** In the future we might be able to use top level `await` in order to import only on the server (e.g.: `await import(“react-dom/server”)`) Until then we need to mix CommonJS and ESM in favor of messing with the webpack config.
15 lines
430 B
JavaScript
15 lines
430 B
JavaScript
import React from 'react'
|
|
|
|
// We don't want to send 'react-dom/server' to the client
|
|
let ReactDOMServer
|
|
if (typeof window === 'undefined') {
|
|
ReactDOMServer = require('react-dom/server')
|
|
}
|
|
|
|
export default function Noscript ({ children }) {
|
|
if (!ReactDOMServer) {
|
|
return null
|
|
}
|
|
const staticMarkup = ReactDOMServer.renderToStaticMarkup(children)
|
|
return <noscript dangerouslySetInnerHTML={{ __html: staticMarkup }} />
|
|
}
|