Skip to content

Commit eadb2a9

Browse files
committed
syntaxhighlighterもdynamic importに変更
1 parent 0b373f0 commit eadb2a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/[docs_id]/markdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Markdown, { Components } from "react-markdown";
22
import remarkGfm from "remark-gfm";
3-
import SyntaxHighlighter from "react-syntax-highlighter";
43
import { EditorComponent, getAceLang } from "../terminal/editor";
54
import { ExecFile } from "../terminal/exec";
65
import { useChangeTheme } from "./themeToggle";
@@ -11,6 +10,9 @@ import {
1110
import { ReactNode } from "react";
1211
import { getRuntimeLang } from "@/terminal/runtime";
1312
import { ReplTerminal } from "@/terminal/repl";
13+
import dynamic from "next/dynamic";
14+
// SyntaxHighlighterはファイルサイズがでかいので & HydrationErrorを起こすので、SSRを無効化する
15+
const SyntaxHighlighter = dynamic(() => import("react-syntax-highlighter"), { ssr: false });
1416

1517
export function StyledMarkdown({ content }: { content: string }) {
1618
return (

0 commit comments

Comments
 (0)