
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
server-only-module
Advanced tools
This is a marker package to indicate that a module can only be used in a server environment.
Framework-agnostic way to mark JavaScript modules as Server or Client only.
Inspired by server-only and client-only.
Note: If you're already using a React framework, there's no need of using this package, just use server-only or client-only as indicated here: Rendering: Composition Patterns | Next.js - Keeping Server-only Code out of the Client Environment
npm install server-only-module
# or
npm install client-only-module
Use it in your modules:
import 'server-only-module';
// or
import 'client-only-module';
async function yourCode() {
...
}
npm run test
# Don't forget to bump the version first
npm run release:server-only
npm run release:client-only
This package uses Node.js' Conditional Exports, hence the minimum required Node version is 12.
FAQs
This is a marker package to indicate that a module can only be used in a server environment.
We found that server-only-module demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.