Packages

cosmiconfig

10.0.1 · 30 Aug 2026MIT172.2M / weekRepositoryHomepagenpmAtom feed

Your version

57 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.

  1. 10.x · latest line
  2. 10.0.1

    30 Aug 2026

    Dependency security update.

  3. 10.0.0

    2 Aug 2026
    • breaking

      The required version range is now ^22.18 || >=24.

    • breaking

      Remove typescript in favor of Node's own type stripping. This means that TypeScript 7 projects are supported, but non-erasable type syntax like namespace or enum is unsupported.

    • breaking

      JSON parsing uses the JSON.parse function directly. parse-json is no longer used for better error messages, since Node has improved theirs.

  4. 9.x
  5. 9.0.2

    7 Jun 2026
    • Fixed a prototype chain issue that may happen when merging different config objects.

    • Fixed the project search strategy not correctly stopping at the package boundary.

  6. 9.0.1

    2 Mar 2026
    • Fixed a race condition where multiple instances existing simultaneously could cause cosmiconfig to fail to load TypeScript config files.

    • Fixed an issue on Windows where CWD being a short path (e.g. C:\Users\USERNA~1) would cause cosmiconfig to fail to load ESM config files.

  7. 9.0.0

    26 Nov 2023
    • breaking

      Meta config files (i.e. config.js and similar) are not looked for in the current working directory anymore. Instead, it looks in the .config subfolder.

    • breaking

      When defining searchPlaces in a meta config file, the tool-defined searchPlaces are merged into this. Users may specify mergeSearchPlaces: false to disable this.

    • Added searchStrategy option:

  8. 8.x
  9. 8.3.6

    13 Sep 2023
    • Ignore search place if accessing it causes ENOTDIR (i.e. if access of a subpath of a file is attempted)

  10. 8.3.5

    8 Sep 2023
    • Pass null to transform function for backwards compat

  11. 8.3.4

    4 Sep 2023
    • Remove node: prefix from imports (f76484a), closes #323

  12. 8.3.3

    3 Sep 2023
  13. 8.3.2

    2 Sep 2023
    • Use .cjs extension for sync compiled typescript

    • Use default for async TS loader

  14. 8.3.1

    2 Sep 2023
    • Do not resolve stopDir when undefined (59082e2), closes #317

  15. 8.3.0

    2 Sep 2023
    • Add support for TypeScript configuration files

  16. 8.2.0

    4 Jun 2023
    • Add support for ECMAScript modules (ESM) to the asynchronous API. End users running Node versions that support ESM can provide .mjs files, or .js files whose nearest parent package.json file contains "type": "module".

  17. 8.1.3

    18 Mar 2023
    • Fixed: existence of meta config breaking default loaders

  18. 8.1.2

    17 Mar 2023
    • Fixed: generation of TypeScript types going to the wrong output path

  19. 8.1.1

    17 Mar 2023
    • Fixed: meta config overriding original options completely (now merges correctly)

  20. 8.1.0

    24 Feb 2023
    • Added: always look at .config.{yml,yaml,json,js,cjs} file to configure cosmiconfig itself, and look for tool configuration in it using packageProp (similar to package.json)

  21. 8.0.0

    21 Nov 2022
    • breaking

      Drop support for Node 10 and 12.

    • breaking

      Use npm package js-yaml to parse YAML instead of npm package yaml.

    • Added: Loader errors now include the path of the file that was tried to be loaded.

  22. 7.x
  23. 7.1.0

    12 Nov 2022
    • Added: Additional default searchPlaces within a .config subdirectory (without leading dot in the file name)

  24. 7.0.1

    21 Aug 2021
    • Fixed: If there was a directory that had the same name as a search place (e.g. "package.json"), we would try to read it as a file, which would cause an exception.

  25. 7.0.0

    1 Aug 2020
    • breaking

      Add ${moduleName}rc.cjs and ${moduleName}.config.cjs to the default searchPlaces, to support users of "type": "module" in recent versions of Node.

    • breaking

      Drop support for Node 8. Now requires Node 10+.

  26. 6.x
  27. 6.0.0

    2 Nov 2019
    • breaking

      The package now has named exports. See examples below.

    • breaking

      Separate async and sync APIs, accessible from different named exports. If you used explorer.searchSync() or explorer.loadSync(), you'll now create a sync explorer with cosmiconfigSync(), then use explorerSync.search() and explorerSync.load().

      // OLD: cosmiconfig v5
      import cosmiconfig from 'cosmiconfig';
      
      const explorer = cosmiconfig('example');
      const searchAsyncResult = await explorer.search();
      const loadAsyncResult = await explorer.load('./file/to/load');
      const searchSyncResult = explorer.searchSync();
      const loadSyncResult = explorer.loadSync('./file/to/load');
      
      // NEW: cosmiconfig v6
      import { cosmiconfig, cosmiconfigSync } from 'cosmiconfig';
      
      const explorer = cosmiconfig('example');
      const searchAsyncResult = await explorer.search();
      const loadAsyncResult = await explorer.load('./file/to/load');
      
      const explorerSync = cosmiconfigSync('example');
      const searchSyncResult = explorerSync.search();
      const loadSyncResult = explorerSync.load('./file/to/load');
    • breaking

      Remove support for Node 4 and 6. Requires Node 8+.

  28. 5.x
  29. 5.2.1

    15 May 2019

    Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.

  30. 5.2.0

    24 Mar 2019
    • Added: packageProp values can be arrays of strings, to allow for property names that include periods. (This was possible before, but not documented or deliberately supported.)

  31. 5.1.0

    17 Feb 2019
    • Added: packageProp values can include periods to describe paths to nested objects within package.json.

  32. 5.0.7

    8 Nov 2018
    • Fixed: JS loader bypasses Node's require cache, fixing a bug where updates to .js config files would not load even when Cosmiconfig was told not to cache.

  33. 5.0.6

    9 Aug 2018
    • Fixed: Better error message if the end user tries an extension Cosmiconfig is not configured to understand.

  34. 5.0.5

    22 May 2018
    • Fixed: load and loadSync work with paths relative to process.cwd().

  35. 5.0.4

    19 May 2018
    • Fixed: rc files with .js extensions included in default searchPlaces.

  36. 5.0.3

    15 May 2018

    Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.

  37. 5.0.2

    7 May 2018
    • Fixed: Allow searchSync and loadSync to load JS configuration files whose export is a Promise.

  38. 5.0.1

    5 May 2018
    • breaking

      packageProp no longer accepts false. If you don't want to look in package.json, write a searchPlaces array that does not include it.

    • removed

      Removed the format option. Formats are now all handled via the file extensions specified in loaders.

    • The loaders option 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.

  39. 5.0.0

    5 May 2018
  40. 4.x
  41. 4.0.0

    16 Jan 2018
    • breaking

      Changed: error message format for JSON parse errors(see [#101][pr-101]). If you were relying on the format of JSON-parsing error messages, this will be a breaking change for you.

    • Licensing improvement: updated parse-json from 3.0.0 to 4.0.0(see [sindresorhus/parse-json#12][parse-json-pr-12]).

    • Changed: set default for searchPath as process.cwd() in explorer.load.

  42. 3.x
  43. 3.1.0

    2 Oct 2017
    • Added: infer format based on filePath

  44. 3.0.1

    17 Sep 2017
    • Fixed: memory leak due to bug in require-from-string.

    • Added: for JSON files, append position to end of error message.

  45. 3.0.0

    16 Sep 2017
    • Removed: support for loading config path using the --config flag. cosmiconfig will not parse command line arguments. Your application can parse command line arguments and pass them to cosmiconfig.

    • Removed: argv config option.

    • Removed: support for Node versions < 4.

  46. 2.x
  47. 2.2.2

    23 Jul 2017
    • Fixed: options.configPath and --config flag are respected.

  48. 2.2.1

    21 Jul 2017
    • 2.2.0 included a number of improvements but somehow broke stylelint. The changes were reverted in 2.2.1, to be restored later.

  49. 2.2.0

    21 Jul 2017
    • 2.2.0 included a number of improvements but somehow broke stylelint. The changes were reverted in 2.2.1, to be restored later.

  50. 2.1.3

    29 Apr 2017
    • Licensing improvement: switched from json-parse-helpfulerror to parse-json.

  51. 2.1.2

    26 Apr 2017
    • Fixed: bug where an ENOENT error would be thrown is searchPath referenced a non-existent file.

    • Fixed: JSON parsing errors in Node v7.

  52. 2.1.1

    4 Dec 2016
    • Fixed: swapped graceful-fs for regular fs, fixing a garbage collection problem.

  53. 2.1.0

    14 Oct 2016
    • Added: Node 0.12 support.

  54. 2.0.2

    11 Oct 2016
    • Fixed: Node version specified in package.json.

  55. 2.0.1

    11 Oct 2016
    • Fixed: no more infinite loop in Windows.

  56. 2.0.0

    8 Oct 2016
    • Changed: module now creates cosmiconfig instances with load methods (see README).

    • Added: caching (enabled by the change above).

    • Removed: support for Node versions <4.

  57. 1.x
  58. 1.1.0

    13 Jan 2016
    • Add rcExtensions option.

  59. 1.0.2

    10 Jan 2016
    • Fix handling of require()'s within JS module configs.

  60. 1.0.1

    27 Nov 2015
    • Switch Promise implementation to pinkie-promise.