Skip to content

@standard-schema/spec resolution fails in pnpm monorepos with Vitest #5948

@schickling

Description

@schickling

When using Effect in a pnpm monorepo with Vitest, the re-exported @standard-schema/spec fails to resolve:

Error: Cannot find package '@standard-schema/spec' imported from ...

Root Cause

  1. effect has @standard-schema/spec as a direct dependency
  2. In pnpm strict mode (default), it's isolated to effect's node_modules/
  3. Vite resolves imports from the importer's location, not the exporter's
  4. When a consuming package runs vitest, Vite can't find @standard-schema/spec

Node.js ESM works correctly - this is Vite/Vitest-specific.

Reproduction

  1. pnpm monorepo (strict mode is default)
  2. Package A depends on Package B
  3. Package B depends on effect and re-exports or uses StandardSchema
  4. Run vitest in Package A → fails

Workaround

Add vitest resolve alias in affected package:

// vitest.config.ts
resolve: {
  alias: {
    '@standard-schema/spec': 'node_modules/effect/node_modules/@standard-schema/spec',
  },
}

Suggestion

Consider making @standard-schema/spec a peer dependency so consumers install it explicitly and pnpm resolves it correctly.

Environment

  • pnpm 10.x (strict mode)
  • vitest 3.x
  • effect 3.x"

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