Skip to content

Commit 8298739

Browse files
committed
fix: SSG compatibility
1 parent d375ba7 commit 8298739

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/doom/src/runtime/components/Masonry.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import MasonryLayout from 'masonry-layout'
1+
import type MasonryLayout from 'masonry-layout'
22
import { useLayoutEffect, useRef, type HTMLAttributes } from 'react'
33

44
export interface MasonryProps extends HTMLAttributes<HTMLDivElement> {
@@ -13,7 +13,11 @@ export const Masonry = ({ options, ...props }: MasonryProps) => {
1313
return
1414
}
1515

16-
const masonry = new MasonryLayout(ref.current, options)
16+
// eslint-disable-next-line @typescript-eslint/no-require-imports
17+
const masonry = new (require('masonry-layout') as typeof MasonryLayout)(
18+
ref.current,
19+
options,
20+
)
1721

1822
return () => {
1923
masonry.destroy?.()

0 commit comments

Comments
 (0)