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


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

cariforef pro premium priority 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 pro premium priority 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 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 pro premium priority 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
  • User: Pro
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 4.0.0
  • Device: macbook
  • Browser: Chrome
  • OS: Mac OS
  • Provided sample code: No
  • Provided link: No
Tags