Skip to content

docs: server-only/client-only in Next.js - #80408

Merged
icyJoseph merged 2 commits into
canaryfrom
docs/server-client-only
Jun 11, 2025
Merged

docs: server-only/client-only in Next.js#80408
icyJoseph merged 2 commits into
canaryfrom
docs/server-client-only

Conversation

@icyJoseph

Copy link
Copy Markdown
Member

@icyJoseph icyJoseph self-assigned this Jun 11, 2025
@ijjk ijjk added created-by: Next.js DevEx team PRs by the DX team. Documentation Related to Next.js' official documentation. labels Jun 11, 2025
Comment thread docs/01-app/01-getting-started/08-server-and-client-components.mdx Outdated
Comment thread docs/01-app/01-getting-started/08-server-and-client-components.mdx Outdated
> **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.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Member Author

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:

@icyJoseph
icyJoseph merged commit 2251d0f into canary Jun 11, 2025
@icyJoseph
icyJoseph deleted the docs/server-client-only branch June 11, 2025 12:06
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)
  ...
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

created-by: Next.js DevEx team PRs by the DX team. Documentation Related to Next.js' official documentation. locked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: "server-only" package is referenced, but not documented

4 participants