-
-
Notifications
You must be signed in to change notification settings - Fork 490
Open
Description
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
- effect has @standard-schema/spec as a direct dependency
- In pnpm strict mode (default), it's isolated to effect's node_modules/
- Vite resolves imports from the importer's location, not the exporter's
- When a consuming package runs vitest, Vite can't find @standard-schema/spec
Node.js ESM works correctly - this is Vite/Vitest-specific.
Reproduction
- pnpm monorepo (strict mode is default)
- Package A depends on Package B
- Package B depends on effect and re-exports or uses StandardSchema
- 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
Labels
No labels