Next.js Discord

Discord Forum

Creating ui library - how to deal with server/client stuff with one bundle file.

Answered
Pacific anchoveta posted this in #help-forum
Open in Discord
Avatar
Pacific anchovetaOP
Hi, I am creating yet another ui library for react and I have simple function that can be run anywhere, but this time I want to run it on the server. Since it is in one bundle it does import all the stuff. How do I fix such stuff? Should I move server compatible components and functions to "@package/react/server" or something?
Image
Answered by joulev
yeah you need two bundles
View full answer

2 Replies

Avatar
yeah you need two bundles
Answer
Avatar
Pacific anchovetaOP
okay thank you