andria-dev / react-spring-modal

Animatable and accessible modals built with react-spring
34 stars 8 forks source link

globalThis is not define #25

Closed skychavda closed 2 years ago

skychavda commented 3 years ago

globalThis is undefined.

I am working on my next js project at the time of making the build of my project error occur.

Here is my tech stack for the current project. "next": "^10.1.3", "react": "^17.0.2", "react-dom": "^17.0.2", "react-spring-modal": "1.0.8",

@andria-dev gave solution in https://github.com/andria-dev/react-spring-modal/issues/1#issuecomment-501865603 this issue but after installing this package to my current project but nothing happen to this error.

andria-dev commented 3 years ago

@skychavda You have to load the polyfill for it to take effect. If you want more help I'll need more information than what you're giving me now. If you follow the instructions for @ungap/global-this it specifically says to import the package to activate it. This should be done before the code that errors out with globalThis is undefined can run.

import '@ungap/global-this'
// or 
require('@ungap/global-this')

What version of this package are you running? What version of Node.js are you running? Do you have a repo with your code I could see? If not, could you create a very simple reproduction of this issue and share it on here? Can I see the full error logs so that I can understand what line of code is causing this issue?

skychavda commented 2 years ago

@andria-dev Thank you for your help I'll try your solution and If I get an error then let you know.