Open GeorgeHulpoi opened 4 months ago
Hello @AlessioGr ! I did a reproduction over here: https://github.com/GeorgeHulpoi/payload-package-hook-client
import 'server-only';
in package
folder.package
with pnpm build
and pnpm pack
.payload
(a PayloadCMS blank project) and install the package.payload
project it is a collection called Tests
which uses the payload-package
.payload-package
into serverComponentsExternalPackages
(next.config.js) will generate the error.Now, seems like skipping step 5 will not produce the issue. Thus, it may not be issue, but needs to be documented for plugin creators.
Link to reproduction
No response
Payload Version
3.0.0-beta.58
Node Version
v20.9.0
Next.js Version
15.0.0-rc.0
Describe the Bug
Using a Payload hook with
import 'server-only';
seems to not produce any issue, but if the same logic is moved to a package, that piece of code seems to be in client (therefore throwing error).Reproduction Steps
import 'server-only';
in the local Payload project.dev
folder for e2e testing).server-only
.Therefore, if you want to use my plugin as reference, during end-to-end tests there is no problem with that piece. The only problem arise when packing the local package and importing it into a external Payload project.
Adapters and Plugins
No response