Production mode restricts analysis to code that ships to users, ignoring test and development files.
fallow dead-code --production
Or set it in your config:
// .fallowrc.json
{
"production": true
}
| Behavior | Default | Production |
|---|---|---|
Test files (*.test.*, *.spec.*, __tests__/) | Included | Excluded |
Story files (*.stories.*) | Included | Excluded |
Mock files (__mocks__/) | Included | Excluded |
| Package.json scripts analyzed | All | Only start, build, serve, preview, prepare, prepublishOnly, postinstall, and pre/post lifecycle hooks for start, build, serve, install |
| Unused devDependencies | Reported | Skipped |
| Type-only dependencies | Not flagged | Flagged (should be devDependencies) |
● Unused exports (2)
src/utils/format.ts
:12 formatCurrency
:28 formatPercentage
Exported symbols with zero references: https://docs.fallow.tools/explanations/dead-code#unused-exports
● Unused dependencies (1)
moment
Packages in dependencies never imported: https://docs.fallow.tools/explanations/dead-code#unused-dependencies
● Type-only dependencies (1)
zod → move to devDependencies (only imported via 'import type')
Production dependencies only used as types: https://docs.fallow.tools/explanations/dead-code#type-only-dependencies
✗ 4 issues (19ms, production mode, 623/847 files)
In production mode, fallow detects dependencies that are only imported via import type:
import type { Config } from 'some-package'; // Type-only, erased at runtime
These packages belong in devDependencies since types are erased at runtime and don't need to be installed in production.
In monorepos, production mode catches dependencies that should be devDependencies, keeping each package's install footprint minimal.
Combined mode (bare fallow) and fallow audit can enable production mode per analysis instead of globally:
// .fallowrc.json
{
"production": {
"health": true,
"deadCode": false,
"dupes": false
}
}
Use --production-health, --production-dead-code, or --production-dupes for one invocation, or FALLOW_PRODUCTION_HEALTH=true and the related env vars in CI. The global --production flag still enables production mode for every analysis.
Precedence (highest to lowest): CLI flags, per-analysis env var, global FALLOW_PRODUCTION, config. CLI flags only enable; env vars and config can also disable. Worked examples:
# Run health in production mode, dead-code and dupes on the full tree
fallow --production-health
# Same, via env var (useful in CI templates that pass env-only)
FALLOW_PRODUCTION_HEALTH=true fallow
# Per-analysis env wins over the global env, so this runs health in production
# mode even though the global env says off (the typical CI-template case)
FALLOW_PRODUCTION=false FALLOW_PRODUCTION_HEALTH=true fallow
# CLI flags beat env vars; this enables all three regardless of FALLOW_PRODUCTION_* env
fallow --production