Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Install with latest next.js : ReferenceError: window is not defined

cariforef free asked 2 years ago


Hello,

I can not make mdb react version 4 work with Next.js. I get : error - ReferenceError: window is not defined

can you help me ? Thanks. Didier


Krzysztof Wilk staff commented 2 years ago

Hi!

We don't guarantee the proper working of our package with the Next.js at this moment. The integration is planned for the near future. Anyway - can you share your code with me? Maybe I'll be able to help :)


cariforef free commented 2 years ago

Hello Krzysztof,

Do you have a date planned for this integration ? Thanks.


Krzysztof Wilk staff commented 2 years ago

Hi!

Unfortunately, we don't have planned it yet.


jlopez994 free answered 2 years ago


Hi,

I have the same issue. It seems it comes from this line (node_modules/mdb-react-ui-kit/dist/mdb-react-ui-kit.js:1:39365):

Le.defaultProps={offset:10,container:window}

So a possible workaround could be replacing it with something like this:

Le.defaultProps={offset:10,container:typeof window==='undefined'?{}:window}

Hope it helps!


cariforef free commented 2 years ago

Hi jlopez994,

It works !! thanks a lot. Didier



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: MDB5 4.0.0
  • Device: macbook
  • Browser: Chrome
  • OS: Mac OS
  • Provided sample code: No
  • Provided link: No