Use import "client-only" to mark styled-jsx as client only packages for server components, so that when users try to import it on server layer it will error in next.js
Expected error if you use styled-jsx in server components rather than client components
error - ../../../node_modules/.pnpm/client-only@0.0.1/node_modules/client-only/error.js (1:6) @ eval
error - Error: This module cannot be imported from a Server Component module. It should only be used from a Client Component.
at eval (webpack-internal:///(sc_server)/../../../../node_modules/.pnpm/client-only@0.0.1/node_modules/client-only/error.js:1:7)
Use
import "client-only"
to mark styled-jsx as client only packages for server components, so that when users try to import it on server layer it will error in next.jsExpected error if you use styled-jsx in server components rather than client components
x-ref: https://github.com/vercel/next.js/pull/41414