TW-Elements icon indicating copy to clipboard operation
TW-Elements copied to clipboard

ReferenceError: document is not defined

Open nonfungible-dev opened this issue 3 years ago • 4 comments

NextJS applications fail to load when attempting to import tw-elements; this is because the document object is not available when using server-side rendering.

This comment seems to imply that the fix will be to wrap all references to document in a check to ensure it's defined.

if(!(typeof document === "undefined")) {
  // Handle document-related logic here
}

nonfungible-dev avatar Jan 18 '22 22:01 nonfungible-dev

Closing due to duplication: https://github.com/mdbootstrap/Tailwind-Elements/issues/1038

smolenski-mikolaj avatar Nov 30 '22 08:11 smolenski-mikolaj