Fix/pdf preview in build (#11621)

This commit is contained in:
zxhlyh
2024-12-13 11:01:53 +08:00
committed by GitHub
parent fa3dcbb3bc
commit 3d803c2e80
4 changed files with 40 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
'use client'
import dynamic from 'next/dynamic'
type DynamicPdfPreviewProps = {
url: string
onCancel: () => void
}
const DynamicPdfPreview = dynamic<DynamicPdfPreviewProps>(
(() => {
if (typeof window !== 'undefined')
return import('./pdf-preview')
}) as any,
{ ssr: false }, // This will prevent the module from being loaded on the server-side
)
export default DynamicPdfPreview