Where Does Madge Store Its Config?
Madge reads graph options from a .madgerc file in the project or home folder, or from the madge key in package.json.
Last updated
Madge works fine with zero config for a quick circular dependency check. A .madgerc file enters the picture once you want lasting settings: excluded patterns, file extensions, layout and colors, Graphviz options.
Discovery checks the project first, then the home folder, then package.json. Commit the project file so the whole team graphs the same thing; keep personal tweaks in the home copy.
Where Madge stores this, by platform
[RepoDir]\.madgerc
Graph options (excludeRegExp, fileExtensions, tsConfig, layout). Alternatives: the madge key in package.json, or madge --config <file> for one-off runs.
[RepoDir]/.madgerc
Same candidates. The home folder copy (~/.madgerc) applies when no project file exists, which is convenient for ad-hoc checks across repos.
[RepoDir]/.madgerc
Same layout. Image output (madge --image graph.png) needs Graphviz installed; the config only controls the graph, not the renderer install.
Frequently asked questions
How do I make Madge respect my TypeScript path aliases?
Put the shared bits in .madgerc and reference the existing tsconfig via the tsConfig property. Madge uses it for alias resolution, so both tools read the same paths.
Can I test Madge settings without editing the committed file?
Pass madge --config <file>. That file replaces discovery entirely, which suits repos where the committed .madgerc targets CI and you want local experiments.
Notice an outdated path? Let us know.