> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fallow.tools/llms.txt
> Use this file to discover all available pages before exploring further.

# Production mode

> Restrict fallow's dead code analysis to production code by excluding test files, devDependencies, and type-only imports.

Production mode restricts analysis to code that ships to users, ignoring test and development files.

```bash theme={null}
fallow dead-code --production
```

Or set it in your config:

```jsonc theme={null}
// .fallowrc.json
{
  "production": true
}
```

## What changes in production mode

| 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)                                                                                                                              |

```bash title="$ fallow dead-code --production" theme={null}
● 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)
```

## Type-only dependency detection

In production mode, fallow detects dependencies that are only imported via `import type`:

```ts theme={null}
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.

<Tip>
  In monorepos, production mode catches dependencies that should be devDependencies, keeping each package's install footprint minimal.
</Tip>

## Per-analysis production mode

Combined mode (bare `fallow`) and `fallow audit` can enable production mode per analysis instead of globally:

```jsonc theme={null}
// .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:

```bash theme={null}
# 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
```

## See also

<CardGroup cols={2}>
  <Card title="CI Integration" icon="circle-check" href="/integrations/ci">
    Use production mode in your CI pipeline for lean, fast checks.
  </Card>

  <Card title="Rules & Severity" icon="scale-balanced" href="/configuration/rules">
    Control which issue types are errors, warnings, or disabled.
  </Card>
</CardGroup>
