react-custom-roulette icon indicating copy to clipboard operation
react-custom-roulette copied to clipboard

ReferenceError: window is not defined

Open santoshi15 opened this issue 3 years ago • 3 comments

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

santoshi15 avatar Mar 12 '22 18:03 santoshi15

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

bsmith20681 avatar Mar 25 '22 22:03 bsmith20681

I get the same issue with Next.js too.

antrant avatar Mar 28 '22 05:03 antrant

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 :'(

Amphaal avatar Apr 02 '22 16:04 Amphaal

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

Acarvajal904 avatar Apr 13 '23 14:04 Acarvajal904