Next.js Discord

Discord Forum

How can I TSUP a package with 'use client'?

Unanswered
American black bear posted this in #help-forum
Open in Discord
Avatar
American black bearOP
Hi, I'm trying to use TSUP to create a reusable package for my Next.js project.

For some reason, I can't get this to keep the use client directives at the top of the file. Causing the project to work on dev, but not when building.

How are you guys packaging your modules / components so that they're preserving use client only in the files/chunks they need to be preserved in? Not looking for the global banner because it breaks certain server components.

Thank you!
Image

0 Replies