Skip to content
Fallow home
All docs pages

Production mode

Get findings for the code you ship only. Production mode excludes test files, story files, and devDependencies, and flags dependencies that are only imported as types.

Production mode limits the analysis to code that ships to users. Fallow ignores test and development files, so the report shows only the unused code and dependencies in your production build.

fallow dead-code --production

You can also set it in your config:

// .fallowrc.json
{
  "production": true
}

What changes in production mode

BehaviorDefaultProduction
Test files (*.test.*, *.spec.*, *.e2e.*, __tests__/, test/, tests/)IncludedExcluded
Story files (*.stories.*)IncludedExcluded
Mock files (__mocks__/)IncludedExcluded
Package.json scripts analyzedAllOnly start, build, serve, preview, prepare, prepublishOnly, postinstall, and pre/post lifecycle hooks for start, build, serve, install
Unused devDependenciesReportedSkipped
Unused optionalDependenciesReportedSkipped
Test-only dependenciesFlagged (move to devDependencies)Skipped
Type-only dependenciesNot flaggedFlagged (move to devDependencies)
● Unused exports (2)
  src/utils/format.ts
    :12 formatCurrency
    :28 formatPercentage
  Exported symbols with no known consumers
  https://docs.fallow.tools/explanations/dead-code#unused-exports

● Unused dependencies (1)
  moment
  Listed in dependencies but never imported
  https://docs.fallow.tools/explanations/dead-code#unused-dependencies

● Type-only dependencies (1)
  zod  →  move to devDependencies (only imported via 'import type')
  Dependencies only used for type imports; consider moving to devDependencies
  https://docs.fallow.tools/explanations/dead-code#type-only-dependencies

✗ 4 issues (19ms, production mode, 623/847 files)

Type-only dependency detection

In production mode, fallow finds dependencies that your code imports only with import type:

import type { Config } from 'some-package';  // Type-only, erased at runtime

Move these packages to devDependencies. The compiler erases types, so production installs do not need them.

In a monorepo, production mode finds the dependencies in each package that belong in devDependencies. This keeps each package install small.

Per-analysis production mode

In combined mode (bare fallow) and in fallow audit, you can enable production mode for each analysis separately:

// .fallowrc.json
{
  "production": {
    "health": true,
    "deadCode": false,
    "dupes": false
  }
}

For one run, pass --production-health, --production-dead-code, or --production-dupes. In CI, set FALLOW_PRODUCTION_HEALTH=true or one of the related env vars. The global --production flag still enables production mode for every analysis.

Fallow applies these sources in order of precedence, highest first:

  1. CLI flags
  2. Per-analysis env var
  3. Global FALLOW_PRODUCTION
  4. Config

--production and the per-analysis flags can only enable production mode. --no-production turns it off for every analysis, and it overrides env vars and config. It conflicts with --production. Env vars and config can enable or disable production mode. 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

# Turn production mode off for every analysis, even when config sets production: true
fallow --no-production

See also