npm / cosmiconfig
cosmiconfig
What changed in cosmiconfig 6 to 10, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-23.
8 breaking3 new APIs and options1 performance3 behavior and defaults4 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initcosmiconfig 104 changes
Breaking changes 2
The required Node.js version range is now ^22.18 || >=24, so projects must use a supported version.
Node's type stripping replaces typescript; TypeScript 7 projects are supported, but non-erasable syntax such as namespace or enum is unsupported.
Behavior and default changes 2
JSON parsing now uses Node's JSON.parse directly instead of parse-json, so error messages come from Node.
Config files encoded as UTF-16 are now supported.
cosmiconfig 910 changes
Breaking changes 2
Meta config files such as config.js are now searched for in the .config subfolder rather than the current working directory.
Without stopDir, the default is now none, so cosmiconfig searches only the current working directory; use global for maximum backwards compatibility.
New APIs and options 3
A special $import key imports another configuration file as a base whose properties can be overridden by the importing file.
Users can set mergeSearchPlaces to false to prevent tool-defined searchPlaces from being merged into searchPlaces defined in a meta config file.
Adds none, project, and global search strategies to control how cosmiconfig traverses directories.
Behavior and default changes 1
With searchStrategy set to global, cosmiconfig also searches OS conventional folders, including XDG-compatible folders on Linux, %APPDATA% on Windows, and Library/Preferences on macOS.
Fixes and other changes 4
Fixed an issue on Windows where a short CWD path could prevent cosmiconfig from loading ESM config files.
Fixed a race condition that could prevent cosmiconfig from loading TypeScript config files when multiple instances exist simultaneously.
Fixes an incorrect ERR_REQUIRE_ESM error when an issue occurs while loading an ESM file.
Fixes a crash when loading a file that cannot be read because of file system permissions.
cosmiconfig 65 changes
Breaking changes 4
The package now uses named exports, so import cosmiconfig with a named import.
Create a sync explorer with cosmiconfigSync(); its search() and load() methods replace explorer.searchSync() and explorer.loadSync().
A named export provides the default loaders for each extension, replacing cosmiconfig.loaders.
Node 4 and 6 are no longer supported; Node 8 or later is required.
Performance 1
All default loaders are now lazy loaded.