Mastermindzh / react-cookie-consent

A small, simple and customizable cookie consent bar for use in React applications.
https://mastermindzh.github.io/react-cookie-consent/
MIT License
603 stars 84 forks source link

React Cookie Consent error when imported to a React component Next14 #196

Closed pedrotomas50 closed 10 months ago

pedrotomas50 commented 10 months ago

import CookieConsent from "react-cookie-consent";

export default function Cookies() { return( <> </> ) }

I am using React 18 and Next 14.0.2 with node v18.18.2 I've also tried with other versions of Node but the error continues. When importing React Cookie Consent to a React component this error occurs:

node_modules/react-cookie-consent/dist/react-cookie-consent.esm.js (34:48) @ prototype ⨯ TypeError: Cannot read properties of undefined (reading 'prototype') at webpack_require (/Users/exmode/Documents/tomas/Work/Harmonium/harmonium/.next/server/webpack-runtime.js:33:42) at eval (./app/components/global/cookies/cookies.js:7:78) at (rsc)/./app/components/global/cookies/cookies.js (/Users/exmode/Documents/tomas/Work/Harmonium/harmonium/.next/server/app/page.js:261:1) at webpack_require (/Users/exmode/Documents/tomas/Work/Harmonium/harmonium/.next/server/webpack-runtime.js:33:42) at eval (./app/page.js:8:92) at (rsc)/./app/page.js (/Users/exmode/Documents/tomas/Work/Harmonium/harmonium/.next/server/app/page.js:312:1) at Function.__webpack_require__ (/Users/exmode/Documents/tomas/Work/Harmonium/harmonium/.next/server/webpack-runtime.js:33:42) at async Promise.all (index 0) digest: "3892524330"

How can I fix this? Help.