New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

server-only-module

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

server-only-module

This is a marker package to indicate that a module can only be used in a server environment.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

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

Usage

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() {
    ...
}

Running Tests

npm run test

Publishing to npm

# Don't forget to bump the version first

npm run release:server-only
npm run release:client-only

Minor Note

This package uses Node.js' Conditional Exports, hence the minimum required Node version is 12.

Keywords

server-only

FAQs

Package last updated on 20 Apr 2024

Did you know?

Socket

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.

Install

Related posts