cosmiconfig
10.0.1 · 30 Aug 2026MIT172.2M / weekRepositoryHomepagenpmAtom feed
9.0.2 is the newest release of 9.x.
In short
2 breaking5 new2 fixed
- breaking
Meta config files (i.e.
config.jsand similar) are not looked for in the current working directory anymore. Instead, it looks in the.configsubfolder. - breaking
When defining
searchPlacesin a meta config file, the tool-definedsearchPlacesare merged into this. Users may specifymergeSearchPlaces: falseto disable this.
Release note
Added
searchStrategyoption:The
nonevalue means that cosmiconfig does not traverse any directories upwards.Breaking change: This is the default value if you don't pass a
stopDiroption, which means that cosmiconfig no longer traverses directories by default, and instead just looks in the current working directory.If you want to achieve maximum backwards compatibility without adding an explicit
stopDir, add thesearchStrategy: 'global'option.
The
projectvalue means that cosmiconfig traverses upwards until it finds apackage.json(or.yaml) file.The
globalvalue means that cosmiconfig traverses upwards until the passedstopDir, or your home directory if nostopDiris given.
- breaking
Meta config files (i.e.
config.jsand similar) are not looked for in the current working directory anymore. Instead, it looks in the.configsubfolder. - breaking
When defining
searchPlacesin a meta config file, the tool-definedsearchPlacesare merged into this. Users may specifymergeSearchPlaces: falseto disable this. Added support for a special
$importkey which will import another configuration fileThe imported file will act as a base file - all properties from that file will be applied to the configuration, but can be overridden by the importing file
For more information, read the import section of the README
Added searching in OS conventional folders (XDG compatible on Linux, %APPDATA% on Windows, Library/Preferences on macOS) for
searchStrategy: 'global'Fixed crash when trying to load a file that is not readable due to file system permissions
Fixed wrong ERR_REQUIRE_ESM error being thrown when there is an issue loading an ESM file