|
@@ -1,45 +1,29 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
|
|
|
|
|
-import fs from 'fs';
|
|
|
|
|
-
|
|
|
|
|
import Document, {
|
|
import Document, {
|
|
|
DocumentContext, DocumentInitialProps,
|
|
DocumentContext, DocumentInitialProps,
|
|
|
Html, Head, Main, NextScript,
|
|
Html, Head, Main, NextScript,
|
|
|
} from 'next/document';
|
|
} from 'next/document';
|
|
|
|
|
|
|
|
-// import { renderScriptTagsByGroup, renderStyleTagsByGroup } from '~/service/cdn-resources-loader';
|
|
|
|
|
-import { resolveFromRoot } from '~/utils/project-dir-utils';
|
|
|
|
|
|
|
|
|
|
-interface GrowiDocumentProps {
|
|
|
|
|
- bootJsPath: string;
|
|
|
|
|
-}
|
|
|
|
|
-declare type GrowiDocumentInitialProps = DocumentInitialProps & GrowiDocumentProps;
|
|
|
|
|
|
|
+// type GrowiDocumentProps = {};
|
|
|
|
|
+// declare type GrowiDocumentInitialProps = GrowiDocumentProps & DocumentInitialProps;
|
|
|
|
|
+declare type GrowiDocumentInitialProps = DocumentInitialProps;
|
|
|
|
|
|
|
|
-async function importCustomManifest(): Promise<any> {
|
|
|
|
|
- const customManifestStr: string = await fs.readFileSync(resolveFromRoot('.next/custom-manifest.json'), 'utf-8');
|
|
|
|
|
- return JSON.parse(customManifestStr);
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-class GrowiDocument extends Document<GrowiDocumentProps> {
|
|
|
|
|
|
|
+class GrowiDocument extends Document {
|
|
|
|
|
|
|
|
static override async getInitialProps(ctx: DocumentContext): Promise<GrowiDocumentInitialProps> {
|
|
static override async getInitialProps(ctx: DocumentContext): Promise<GrowiDocumentInitialProps> {
|
|
|
const initialProps: DocumentInitialProps = await Document.getInitialProps(ctx);
|
|
const initialProps: DocumentInitialProps = await Document.getInitialProps(ctx);
|
|
|
|
|
|
|
|
- const customManifest: any = await importCustomManifest();
|
|
|
|
|
- const bootJsPath = customManifest['boot.js'];
|
|
|
|
|
-
|
|
|
|
|
- return { ...initialProps, bootJsPath };
|
|
|
|
|
|
|
+ return initialProps;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override render(): JSX.Element {
|
|
override render(): JSX.Element {
|
|
|
|
|
|
|
|
- const { bootJsPath } = this.props;
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<Html>
|
|
<Html>
|
|
|
<Head>
|
|
<Head>
|
|
|
- {/* eslint-disable-next-line @next/next/no-sync-scripts */}
|
|
|
|
|
- <script src={bootJsPath}></script>
|
|
|
|
|
{/*
|
|
{/*
|
|
|
{renderScriptTagsByGroup('basis')}
|
|
{renderScriptTagsByGroup('basis')}
|
|
|
{renderStyleTagsByGroup('basis')}
|
|
{renderStyleTagsByGroup('basis')}
|