Next.js Discord

Discord Forum

react-layout-masonry throwing error with next@latest

Unanswered
Black Caiman posted this in #help-forum
Open in Discord
Black CaimanOP
I'm using a package for masonry grid to display images.
https://www.npmjs.com/package/react-layout-masonry

While running, it's throwing error.
Logs:
 ✓ Compiled /favicon.ico/route in 160ms (1121 modules)
 ✓ Compiled in 7.6s (2266 modules)
 âš  Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
 ⨯ node_modules/react-layout-masonry/dist/index.js (1:234) @ E
 ⨯ Internal error: ReferenceError: window is not defined
    at E (./node_modules/react-layout-masonry/dist/index.js:9:73)
    at _ (./node_modules/react-layout-masonry/dist/index.js:9:539)
    at B (./node_modules/react-layout-masonry/dist/index.js:9:742)


Can you guys suggest any better package that actually works with next 13 or something.
It's not even getting build due to this.

1 Reply