react-vimeo icon indicating copy to clipboard operation
react-vimeo copied to clipboard

error - ReferenceError: EventTarget is not defined

Open Jairwin-L opened this issue 2 years ago • 10 comments

install using pnpm, then pnpm dev image env info

"@u-wave/react-vimeo": "^0.9.10",
"react": "18.2.0",
"react-dom": "18.2.0",

Jairwin-L avatar Jun 02 '23 03:06 Jairwin-L

It looks like you're server-rendering. this component does not support that.

goto-bus-stop avatar Jun 02 '23 06:06 goto-bus-stop

It looks like you're server-rendering. this component does not support that.

yes, but using yarn is ok, so I want to know why there is a problem with using pnpm

Jairwin-L avatar Jun 02 '23 11:06 Jairwin-L

that's impossible to say without a full, runnable example of the problem :)

goto-bus-stop avatar Jun 02 '23 11:06 goto-bus-stop

let me try

Jairwin-L avatar Jun 03 '23 03:06 Jairwin-L

@goto-bus-stop I re-reproduced this problem. It seems to be because of the node version. There are two node versions on my computer: 14.19.3 and 18.0.0. The 14 version will have this error, and the 18 version will not

Jairwin-L avatar Jun 08 '23 02:06 Jairwin-L

so really @u-wave/react-vimeo shouldn't be loaded at all on the server, as it includes @vimeo/player which is a client-side only library. This component can't do anything on the server and does not support server-side rendering.

goto-bus-stop avatar Jun 09 '23 17:06 goto-bus-stop

If you are using next I guess you should only import it in client components, but I don't use next myself so I can't say more.

goto-bus-stop avatar Jun 09 '23 17:06 goto-bus-stop

@Jairwin-L if you are using next (what looks like you do), you may try to dynamically import the component with { ssr: false}

tony-matheus avatar Jun 17 '23 01:06 tony-matheus

@Jairwin-L did you able to make it work on node 14?

johndavemanuel avatar Oct 11 '23 04:10 johndavemanuel

@Jairwin-L did you able to make it work on node 14?

sorry, I kind of forgot about it

Jairwin-L avatar Dec 27 '23 13:12 Jairwin-L