Skip to content

Commit c48eb5f

Browse files
committed
fix: dont import react-dom/server directly
1 parent 6b7cdde commit c48eb5f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
12
import { styles as defaultStyles } from "@dash-ui/styles";
23
import type { Styles } from "@dash-ui/styles";
34
import { createStylesFromString } from "@dash-ui/styles/server";
45
import * as React from "react";
5-
import { renderToStaticMarkup } from "react-dom/server";
66

77
/**
88
* A function for creating a React `<style>` component for
@@ -85,8 +85,10 @@ export interface StyleProps {
8585
export function createGatsbyRenderer(styles: Styles<any, any> = defaultStyles) {
8686
/* istanbul ignore next */
8787
return function replaceRenderer<P = any>(props: P): P {
88-
// @ts-expect-error
89-
const bodyString = renderToStaticMarkup(props.bodyComponent);
88+
const bodyString = require("react-dom/server").renderToStaticMarkup(
89+
// @ts-expect-error
90+
props.bodyComponent
91+
);
9092
// @ts-expect-error
9193
props.setHeadComponents([toComponent(bodyString, styles)]);
9294
return props;

0 commit comments

Comments
 (0)