Error: Sorry, the Vimeo Player API is not available in this browser.
This works well in the dev mode but the build throws an error.
I am trying to import and use a React component in the .mdx files in the docs folder.
abc.mdx
import Vimeo from '@u-wave/react-vimeo';
responsive={true}
width={640}
height={480}
/>
(Write your steps here:)
The build version should be successful and should behave like the dev version.
(Write what you thought would happen.)
The prod build error out
(Write what happened. Add screenshots, if applicable.)

https://github.com/ramakrishnan3/ducusaurus-bug-report
-> clone the repo
-> npm i
-> npm start - successful
-> npm run build - errors out
(Paste the link to an example repo, including a siteConfig.js, and exact instructions to reproduce the issue.)
Probably the video component is non-compatible with server-side rendering because it uses browser-specific APIs (e.g. window), which isn't available on the server. This is not specific to Docusaurus. You could try to only render the component in a browser environment by doing
{typeof window !== 'undefined' &&
@yangshun Agreed. But I am using what you have suggested already in my code https://github.com/ramakrishnan3/ducusaurus-bug-report/blob/master/docs/doc2.mdx but it does not work.
Probably the video component is non-compatible with server-side rendering because it uses browser-specific APIs (e.g. window), which isn't available on the server. This is not specific to Docusaurus. You could try to only render the component in a browser environment by doing
{typeof window !== 'undefined' && }
@yangshun I've been hacking away at v2 and ran into something similar, and after several days I came across this thread. This fixed the issue I had, and now I can go out for a beer :) cheers!
But I am using what you have suggested already in my code https://github.com/ramakrishnan3/ducusaurus-bug-report/blob/master/docs/doc2.mdx but it does not work.
That's not syntactically valid code... I meant for you to render something behind the &&.
{typeof window !== 'undefined' && <div>{...}</div>}
By the way when https://github.com/facebook/docusaurus/pull/2296 lands there will be a convenient API to check the execution environment and you no longer have to write typeof window !== 'undefined'
Closing this as it's not a Docusaurus bug.
@davodey could you please tell me how you solved the issue with Vimeo player?
Most helpful comment
@yangshun I've been hacking away at v2 and ran into something similar, and after several days I came across this thread. This fixed the issue I had, and now I can go out for a beer :) cheers!