rescript.json supports "type": "dev" sources and "dev-dependencies", but the compiler always resolves dev-dependencies in the package tree before building. After pnpm install --prod, the build fails because dev-dependency packages aren’t installed. The --filter flag doesn’t help — package tree resolution happens before source filtering.
After pnpm install --prod, building fails: upward traversal did not find 'rescript-ava'
rescript build --filter '!__tests__' fails with the same error
Suggestion
A flag like rescript build --prod that:
Skips "type": "dev" sources (both in the root package and its dependencies)
Skips "dev-dependencies" during package tree resolution
Why it would help
Production/Docker builds could use pnpm install --prod without breaking the compiler
Dev-only packages (testing frameworks, code generators, benchmarking tools, linters, documentation generators, etc.) wouldn’t need to be installed by consumers
Monorepos with per-package dev tooling wouldn’t need every dev dependency installed everywhere
Smaller attack surface in production — fewer dependencies means fewer potential supply chain vulnerabilities
Aligns with how npm/pnpm/yarn distinguish dev vs prod dependencies
Well dev-dependencies of npm dependencies are skipped regardless already. It’s just when they are local or in a monorepo package that rescript will build them. Before we had a dev flag to actually turn them on but building everything and having an explicit opt-out is the more consistent behavior with the JS ecosytem.