Skip to content

@effect/platform-node: root imports require redis even for non-Redis APIs #8554

Description

@corelix

What version of Effect is running?

  • effect: 4.0.0-rc.117
  • @effect/platform-node: 4.0.0-rc.117
  • Node.js: 26.9.0
  • pnpm: 12.4.2

Both Effect packages match the current rc dist-tag at the time of reporting.

What steps can reproduce the bug?

Create an empty directory with the following files.

package.json:

{
  "private": true,
  "type": "module",
  "dependencies": {
    "effect": "4.0.0-rc.117",
    "@effect/platform-node": "4.0.0-rc.117"
  }
}

pnpm-workspace.yaml:

autoInstallPeers: false

Install dependencies and import the package:

pnpm install --ignore-scripts
node --input-type=module -e 'await import("@effect/platform-node")'

The import fails because redis is missing.

For comparison, both of these imports succeed in the same installation:

node --input-type=module -e 'await import("@effect/platform-node/NodeRuntime")'
node --input-type=module -e 'await import("@effect/platform-node/NodeHttpServer")'

Disabling automatic peer installation is intentional: it exposes whether applications that do not use Redis can consume the package without installing the Redis client.

What is the expected behavior?

Applications using only non-Redis APIs should ideally be able to consume @effect/platform-node without installing the Redis client, including through the root entry point.

If requiring Redis for all consumers is intentional, could this requirement and the recommended import strategy be documented?

What do you see instead?

The root import fails with:

ERR_MODULE_NOT_FOUND: Cannot find package 'redis' imported from .../@effect/platform-node/dist/NodeRedis.js

The root entry point re-exports NodeRedis, whose module imports redis at the top level. This loads the Redis dependency even when the application does not use Redis APIs.

Additional information

I recognize that redis is currently a required peer dependency, so this reproduction deliberately omits a declared requirement. The concern is whether that requirement needs to apply to non-Redis consumers.

Automatic peer installation satisfies the requirement but installs the Redis client for those consumers as well. Direct subpath imports avoid the runtime failure, although the mandatory peer requirement remains.

Marking the peer optional alone would not resolve the root-import failure; the eager import would also need to be addressed.

Related work:

Would you consider isolating Redis loading to Redis-specific usage and making the peer optional, or is the current package-wide requirement intentional?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions