Skip to content

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 2 commits into from
Jun 11, 2025
Merged

Conversation

icyJoseph
Copy link
Contributor

@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
> **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
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
Contributor 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
71 checks passed
@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)
  ...
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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