I tried create a package with ui components for use in Nextjs 13 web app, but I can't build components with "use client" in the beginning of code, like that:
"use client"
import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
const AspectRatio = AspectRatioPrimitive.Root
export { AspectRatio }
So when I build this code, the "use client" has removed:

Error on import component of package in app:

Obs.: The component needs to be imported into a server side file, in which case it would be the layout.tsx
Have a workround or option for this?
I use:
- turbo: ^1.7.4
- next: ^13.1.6
- tsup: ^6.1.3
- typescript: ^4.9.4
tsconfig.json of ui package:
{
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"lib": ["ES2015", "DOM"],
"module": "ESNext",
"target": "ES6",
"jsx": "react-jsx",
"baseUrl": "./src",
"paths": {
"@/*": ["./*"]
}
},
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}
tsup.config.ts

I tried create a package with ui components for use in Nextjs 13 web app, but I can't build components with
"use client"in the beginning of code, like that:So when I build this code, the

"use client"has removed:Error on import component of package in app:

Obs.: The component needs to be imported into a server side file, in which case it would be the
layout.tsxHave a workround or option for this?
I use:
tsconfig.jsonof ui package:{ "compilerOptions": { "composite": false, "declaration": true, "declarationMap": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "inlineSources": false, "isolatedModules": true, "moduleResolution": "node", "noUnusedLocals": false, "noUnusedParameters": false, "preserveWatchOutput": true, "skipLibCheck": true, "strict": true, "lib": ["ES2015", "DOM"], "module": "ESNext", "target": "ES6", "jsx": "react-jsx", "baseUrl": "./src", "paths": { "@/*": ["./*"] } }, "include": ["."], "exclude": ["dist", "build", "node_modules"] }tsup.config.ts