Bugfix. Update generate-web-html function
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { renderToString } from "react-dom/server";
|
||||
import grabContants from "../../../utils/grab-constants";
|
||||
import EJSON from "../../../utils/ejson";
|
||||
import type { LivePageDistGenParams } from "../../../types";
|
||||
@@ -6,8 +7,6 @@ import grabWebPageHydrationScript from "./grab-web-page-hydration-script";
|
||||
import grabWebMetaHTML from "./grab-web-meta-html";
|
||||
import { log } from "../../../utils/log";
|
||||
import { AppData } from "../../../data/app-data";
|
||||
import path from "path";
|
||||
import importReactDomServer from "../../../utils/import-react-dom-server";
|
||||
|
||||
export default async function genWebHTML({
|
||||
component,
|
||||
@@ -26,9 +25,6 @@ export default async function genWebHTML({
|
||||
log.info("component", component);
|
||||
}
|
||||
|
||||
const reactDomServer = await importReactDomServer();
|
||||
const renderToString = reactDomServer.renderToString;
|
||||
|
||||
const componentHTML = renderToString(component);
|
||||
|
||||
if (debug) {
|
||||
|
||||
@@ -7,6 +7,10 @@ export default async function importReactDomServer() {
|
||||
path.join(process.cwd(), "node_modules", "react-dom", "server")
|
||||
);
|
||||
|
||||
if (!reactDomServerDynamicImport.renderToString) {
|
||||
return reactDomServer;
|
||||
}
|
||||
|
||||
return reactDomServerDynamicImport;
|
||||
} catch (error) {
|
||||
return reactDomServer;
|
||||
|
||||
Reference in New Issue
Block a user