-
Notifications
You must be signed in to change notification settings - Fork 28.6k
docs: server-only/client-only in Next.js #80408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
icyJoseph
commented
Jun 11, 2025
docs/01-app/01-getting-started/08-server-and-client-components.mdx
Outdated
Show resolved
Hide resolved
icyJoseph
commented
Jun 11, 2025
docs/01-app/01-getting-started/08-server-and-client-components.mdx
Outdated
Show resolved
Hide resolved
lubieowoce
approved these changes
Jun 11, 2025
delbaoliveira
approved these changes
Jun 11, 2025
> **Good to know**: The corresponding [`client-only` package](https://www.npmjs.com/package/client-only) can be used to mark modules that contain client-only logic like code that accesses the `window` object. | ||
The corresponding [`client-only` package](https://www.npmjs.com/package/client-only) can be used to mark modules that contain client-only logic like code that accesses the `window` object. | ||
|
||
In Next.js, installing `server-only` or `client-only` is **optional**. However, if your linting rules flag extraneous dependencies, you may install them to avoid issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused?
Suggested change
In Next.js, installing `server-only` or `client-only` is **optional**. However, if your linting rules flag extraneous dependencies, you may install them to avoid issues. | |
In Next.js, installing `server-only` or `client-only` is **optional**. However, if your linting rules flag unused dependencies, you may install them to avoid warnings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, this was more about covering base for importing a dependency that's not defined in your package.json
, for example:
schoenwaldnils
added a commit
to schoenwaldnils/next.js
that referenced
this pull request
Jun 16, 2025
…aldnils/next.js into fix/experimental-https-metaimage * 'fix/experimental-https-metaimage' of github.com:schoenwaldnils/next.js: (74 commits) [dev-overlay] Move code into new top-level folder in src/next-devtools (vercel#80281) Docs: Polish Getting Started section (vercel#80402) Fix a couple typos (vercel#80080) feat(turbopack): Add simple tree shaker (vercel#78286) docs: server-only/client-only in Next.js (vercel#80408) v15.4.0-canary.78 Add response handling inside handlers (vercel#80189) Docs: Getting Started feedback (vercel#80401) [test] unflake turbopack dev navigation test case (vercel#80407) Use new `browserWithResponse()` method in `empty-fallback-shells` tests (vercel#80406) Update Turbopack development test manifest (vercel#80399) Update Rspack development test manifest (vercel#80397) Update Rspack production test manifest (vercel#80398) Update Turbopack production test manifest (vercel#80400) Require that `turbo_tasks::value_trait` items be annotated with `turbo-tasks::function` (vercel#79178) Docs: Clarify how intercepting routes work and update example (vercel#80145) build(turbopack): Update `swc_core` to `v27.0.1` (vercel#80338) v15.4.0-canary.77 Turbopack: include obsolete entries in computation (vercel#80362) fix(next-swc-wasm): Only enable turbo-rcstr's napi feature when building the next-swc-napi crate/package (vercel#80390) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
created-by: Next.js DevEx team
PRs by the DX team.
Documentation
Related to Next.js' official documentation.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: https://linear.app/vercel/issue/DOC-4679/server-only-client-only-as-managed-by-nextjs
Fixes: #71071