mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
28 lines
596 B
JavaScript
28 lines
596 B
JavaScript
import Document_, { Head, Main, NextScript } from 'next/document'
|
|
import htmlescape from 'htmlescape'
|
|
|
|
const { API_URL } = process.env
|
|
const env = { API_URL }
|
|
|
|
export default class Document extends Document_ {
|
|
static async getInitialProps (ctx) {
|
|
const props = await Document_.getInitialProps(ctx)
|
|
return props
|
|
}
|
|
|
|
render () {
|
|
return (
|
|
<html>
|
|
<Head />
|
|
<body>
|
|
<Main />
|
|
<script
|
|
dangerouslySetInnerHTML={{ __html: '__ENV__ = ' + htmlescape(env) }}
|
|
/>
|
|
<NextScript />
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|
|
}
|