From 0b11f5d7bf7e204c29fdde067916a77e4f49fed9 Mon Sep 17 00:00:00 2001 From: tianyaxiang Date: Sun, 2 Feb 2025 18:43:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20Mermaid=20=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=9B=BE=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.js | 19 ++++++++++++++++++- src/app/wechat/page.tsx | 21 +++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/next.config.js b/next.config.js index 0519ecb..7c5a0fe 100644 --- a/next.config.js +++ b/next.config.js @@ -1 +1,18 @@ - \ No newline at end of file +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, + swcMinify: true, + // Ensure external packages are handled correctly + transpilePackages: ['mermaid', 'katex'], + // Configure webpack if needed + webpack: (config) => { + // Handle mermaid.js + config.resolve.fallback = { + ...config.resolve.fallback, + fs: false, + }; + return config; + }, +} + +module.exports = nextConfig \ No newline at end of file diff --git a/src/app/wechat/page.tsx b/src/app/wechat/page.tsx index 4c5d6f0..1844332 100644 --- a/src/app/wechat/page.tsx +++ b/src/app/wechat/page.tsx @@ -1,10 +1,27 @@ -import WechatEditor from '@/components/editor/WechatEditor' +import dynamic from 'next/dynamic' +import { Suspense } from 'react' + +// Dynamically import WechatEditor with no SSR +const WechatEditor = dynamic(() => import('@/components/editor/WechatEditor'), { + ssr: false, + loading: () => ( +
+
Loading editor...
+
+ ), +}) export default function WechatPage() { return (
- + +
Loading editor...
+
+ }> + +
)