cosmiconfig
10.0.1 · 30 Aug 2026MIT172.2M / weekRepositoryHomepagenpmAtom feed
Upgrading cosmiconfig From 5.0.0 to 5.0.1
1 release in betweenevery note read
Reading releases, release notes and advisories…
- 2
- changes to make
- 0
- advisories fixed
- 0
- new
- 0
- fixes
Before you upgrade
Tick each one off as you go- breaking5.0.1
- breaking5.0.1
12 other lines we could not sort, mostly version bumps
- 5.0.1
The
loadersoption allows you specify custom functions to derive config objects from files. Your loader functions could parse ES2015 modules or TypeScript, JSON5, even INI or XML. Whatever suits you. - 5.0.1
The
searchPlacesoption allows you to specify exactly where cosmiconfig looks within each directory it searches. - 5.0.1
The combination of
loadersandsearchPlacesmeans that you should be able to load pretty much any kind of configuration file you want, from wherever you want it to look. - 5.0.1
search()now searches up the directory tree, andload()loads a configuration file that you don't need to search for. - 5.0.1
The
syncoption has been replaced with separate synchronous functions:searchSync()andloadSync(). - 5.0.1
clearFileCache()andclearDirectoryCache()have been renamed toclearLoadCache()andclearSearchPath()respectively. - 5.0.1
The default JS loader uses
require, instead ofrequire-from-string. So you could userequirehooks to control the loading of JS files (e.g. pass them through esm or Babel). In most cases it is probably preferable to use a custom loader. - 5.0.1
The options
rc,js, andrcExtensionshave all been removed. You can accomplish the same and more withsearchPlaces. - 5.0.1
The default
searchPlacesincludercfiles with extensions, e.g..thingrc.json,.thingrc.yaml,.thingrc.yml. This is the equivalent of switching the default value of the oldrcExtensionsoption totrue. - 5.0.1
The option
rcStrictJsonhas been removed. To get the same effect, you can specifynoExt: cosmiconfig.loadJsonin yourloadersobject.