-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plyr-react library with Next.js 14 #60862
Comments
You got to import plyr dynamically. |
Hi @timomedia I used Dynamic Imports as @brkcrdk mentioned, I'll leave you an example: export function Video() {
const [importedComponent, setImportedComponent] = useState<ReactElement | null>(null)
useEffect(() => {
const importComponent = async () => {
const myModule = await import('plyr-react')
const Plyr = myModule.default
setImportedComponent(<Plyr {...plyrProps} />)
}
importComponent()
}, [])
return (
<section className='aspect-video mx-16 mt-20 mb-28'>
{importedComponent}
</section>
)
} |
Thank you |
Just import using the dynamic function like: import dynamic from 'next/dynamic'
const Plyr = dynamic(() => import("plyr-react"), { ssr: false }); |
This fixed my issue. |
There's an issue on that library: chintan9/plyr-react#873. This is not a Next.js issue but an issue in the library used as it's reading |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/hidden-frost-mpdjj?file=%2Fsrc%2FHLS.tsx
To Reproduce
I am using plyr-react in a Next.js 14.1.0 environment and pages using plyr-react (5.3.0) fail to load or build with errors of type
Current vs. Expected behavior
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
I didn't have this problem when I worked on my site with next.js 14.0.0, but now I upgraded everything I have it all the time, this blocks the build.
The text was updated successfully, but these errors were encountered: