Topic: MDReact and Gatsby - Not working

gradlon pro asked 5 years ago


Hey, I am Building my first site using MDReact and Gatsby, at first it looked promising but soon I ran into two issues which are deal-breaking.
  1. Gatsby does not work with React-Router thus I am having difficulties creating a proper navigation with all the wanted features.
  2. When building the production site it fails with an error. WebpackError: ReferenceError: window is not defined
I have looked through the forums but did not find much about it other than stating that it is known and a fix is on the way, but those posts are 6 months old and since then nothing happened. Are there some known Workarounds? Is there an ETA for a fix? Kind regards Gradlon von Känel

mark-steven-au premium answered 1 year ago


Has there been any progress on MDB5 and Gatsby working together yet? Would like to use MDB but only if it can work with Gatsby Cheers Mark


Krzysztof Wilk staff commented 1 year ago

Hi!

I'm afraid there's no update on this topic. But I think this answer should be helpful: https://mdbootstrap.com/support/react/install-with-latest-next-js-referenceerror-window-is-not-defined/


diznutz priority answered 2 years ago


Sadly, MDB5 React doesn't work either:

failed Building static HTML for pages - 6.710s

 ERROR #95312 

"document" is not available during server side rendering.
See our docs page for more info on this error:
https://gatsby.dev/debug-html





  WebpackError: ReferenceError: document is not defined  

  - mdb-react-ui-kit.esm.js:1 
    [arga-intercultural]/[mdb-react-ui-kit]/dist/mdb-reac    t-ui-kit.esm.js:1:35059

Is there any plan for supporting SSR frameworks in the near future?


Wojciech Staniszewski staff commented 2 years ago

It is definitely in our plans, but I cannot guarantee a date at this time



We do not support any frameworks yet. But you could try installing MDB5 React and check if it works


diznutz priority answered 2 years ago


Hello, is there any news related with solving MDB React integration with Gatsby? (or SSR frameworks in general). This is a critical stopper for our projects.


Anna Morawska staff answered 5 years ago


Hi gradlon , unfortunately, our library doesn't support server-side rendering for now. It works only as client-side js. Best, Ania

chokeul8r free commented 4 years ago

mdbootstrap is throwing an error on gatsby build. Works fine in dev mode but the minute you attempt to build for production it throws a webpack ssr error because it references the window ( "navigator" is not available during server side rendering. ). I was under the impression that mdbootstrap had resolved this issue when you decided to create a Gatsby Starter with the free version of your React Library. That is why I went ahead a purchased the Pro Version + Bundle.

Please tell me there is a work around.


Piotr Glejzer staff commented 4 years ago

we have a problem with SSR, we will try to resolve this as soon as possible. One component is breaking a whole server-side rendering and we are looking for a workaround this but there is a little problem with export-dynamic modules in the React because React doesn't support this yet. This will feature will be a core in the React ecosystem in the next version but we will fix it.



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: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.7.1
  • Device: All
  • Browser: All
  • OS: Windows
  • Provided sample code: No
  • Provided link: No
Tags