docs: note that non-function exports of a use cache file are not available to…
docs: note that non-function exports of a use cache file are not available to Client Components (#100594) In a file with `'use cache'` at the top, Client Components can import the exported functions, but other exports such as constants and objects are dropped from what the client receives. Importing one fails the build with `Export X doesn't exist in target module`, and the docs didn't say so. This adds a Good to know bullet to the `use cache` API reference that states the restriction and the fix: move shared values to a separate file without the directive. The client-side drop is covered by the compiler test case `crates/next-custom-transforms/tests/fixture/server-actions/client-graph/18`. The build error was reproduced on 16.4.2 and 16.5.0-canary.23 with Turbopack production builds. - f3a47ec2154 docs: note that non-function exports of a use cache file are not available to Client Components
Showing
Please
register
or
sign in
to comment