You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running payload generate:types does not work when using functions in hooks that have import 'server-only' in them, as for whatever reason, it seems to run functions in a client context during type generation? I would venture to guess that it would not matter where it is ran; anything inside the payload Config would likely see this issue as well.
server-only is a best practice and is commonly used to ensure that functions made to only run on the server are never allowed to run on the client. The error does not trigger in development; so, we know that hooks are running on the server, as they should. However, it is not the case during the generate:types process.
It's becoming quite taxing (for multiple issues with generate:types now), to have to uncomment many parts of my application, any time that I need to generate:types.
The text was updated successfully, but these errors were encountered:
Running
payload generate:types
does not work when using functions in hooks that haveimport 'server-only'
in them, as for whatever reason, it seems to run functions in a client context during type generation? I would venture to guess that it would not matter where it is ran; anything inside the payloadConfig
would likely see this issue as well.server-only
is a best practice and is commonly used to ensure that functions made to only run on the server are never allowed to run on the client. The error does not trigger in development; so, we know that hooks are running on the server, as they should. However, it is not the case during thegenerate:types
process.Here is a reproduction.
It's becoming quite taxing (for multiple issues with
generate:types
now), to have to uncomment many parts of my application, any time that I need togenerate:types
.The text was updated successfully, but these errors were encountered: