_document.tsx37 lines · main
| 1 | import Document, { DocumentContext, Head, Html, Main, NextScript } from 'next/document' |
| 2 | |
| 3 | import { BASE_PATH, IS_PLATFORM } from '@/lib/constants' |
| 4 | |
| 5 | class MyDocument extends Document { |
| 6 | static async getInitialProps(ctx: DocumentContext) { |
| 7 | const initialProps = await Document.getInitialProps(ctx) |
| 8 | |
| 9 | return initialProps |
| 10 | } |
| 11 | |
| 12 | render() { |
| 13 | return ( |
| 14 | <Html lang="en"> |
| 15 | <Head> |
| 16 | {/* Workaround for https://github.com/suren-atoyan/monaco-react/issues/272 */} |
| 17 | <link |
| 18 | rel="stylesheet" |
| 19 | type="text/css" |
| 20 | data-name="vs/editor/editor.main" |
| 21 | href={ |
| 22 | IS_PLATFORM |
| 23 | ? 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/editor/editor.main.css' |
| 24 | : `${BASE_PATH}/monaco-editor/editor/editor.main.css` |
| 25 | } |
| 26 | /> |
| 27 | </Head> |
| 28 | <body> |
| 29 | <Main /> |
| 30 | <NextScript /> |
| 31 | </body> |
| 32 | </Html> |
| 33 | ) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | export default MyDocument |