effectussoftware / react-custom-roulette

Repository for the react-custom-roulette library
MIT License
312 stars 112 forks source link

ReferenceError: window is not defined #57

Closed santoshi15 closed 1 year ago

santoshi15 commented 2 years ago

I'm attempting to implement this in my NextJS React app via Typescript, but continue to get an error 'ReferenceError: window is not defined'

bsmith20681 commented 2 years ago

I'm getting the same issue, did you ever find a solution?

antrant commented 2 years ago

I get the same issue with Next.js too.

Amphaal commented 2 years ago

With Next.js, you can use some kind of a workaround by disabling SSR explicitly https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr

const Wheel = dynamic(
    () => import('react-custom-roulette').then(mod => mod.Wheel),
    { ssr: false }
)

... yet, Typescript still complains even if it compiles, so it is not perfect :'(

Acarvajal904 commented 1 year ago

Hi, thank you for your comments. We are aware of the webpack problem, right now we can suggest to use the @Amphaal workaround.