muxinc / elements

Custom elements for working with media in the browser that Just Work™
https://elements-demo-nextjs.vercel.app
MIT License
259 stars 48 forks source link

Feature Request: Support react server components #682

Open danteissaias opened 1 year ago

danteissaias commented 1 year ago

Is there an existing issue for this?

Which Mux Elements/Packages does this apply to? Select all that apply

mux-video-react, mux-audio-react, mux-player-react

Description

Add "use client" directive to the output bundle. https://beta.nextjs.org/docs/rendering/server-and-client-components#convention

Expected Behavior

N/A

dylanjha commented 1 year ago

Thanks for this @danteissaias !

@decepulis I think you looked into this, any reason we should not add the "use client" directive ourselves?

decepulis commented 1 year ago

Thanks, @danteissaias! And yeah @dylanjha we should totally do this.

The only gotcha, esbuild strips out directives like "use client", so we'll have to consider postbuild steps for adding the directive back. I know @luwes considering approaches over in #712

danteissaias commented 1 year ago

Thanks, @danteissaias! And yeah @dylanjha we should totally do this.

The only gotcha, esbuild strips out directives like "use client", so we'll have to consider postbuild steps for adding the directive back. I know @luwes is already on it.

"use client" can be added as a banner