We use our own libraries to encapsulate component designs and functionality. When importing them into our main next.js application web pack erronously forces use client on those imported functions and components. Even something as simple as this triggers the error:
export function classNames(...classes: any[]) {
return classes.filter(Boolean).join(' ')
}
Importing and using this function forces the component to 'use client'.
So the question is how should we set up react libraries correctly to not mess up with the primary's next.js bundler.