summaryrefslogtreecommitdiff
path: root/node_modules/lilconfig/readme.md
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/lilconfig/readme.md')
-rw-r--r--node_modules/lilconfig/readme.md27
1 files changed, 4 insertions, 23 deletions
diff --git a/node_modules/lilconfig/readme.md b/node_modules/lilconfig/readme.md
index ac42df08..99c42623 100644
--- a/node_modules/lilconfig/readme.md
+++ b/node_modules/lilconfig/readme.md
@@ -42,6 +42,10 @@ lilconfigSync(
*/
```
+## ESM
+
+ESM configs can be loaded with **async API only**. Specifically `js` files in projects with `"type": "module"` in `package.json` or `mjs` files.
+
## Difference to `cosmiconfig`
Lilconfig does not intend to be 100% compatible with `cosmiconfig` but tries to mimic it where possible. The key difference is **no** support for yaml files out of the box(`lilconfig` attempts to parse files with no extension as JSON instead of YAML). You can still add the support for YAML files by providing a loader, see an [example](#yaml-loader) below.
@@ -87,29 +91,6 @@ lilconfig('myapp', options)
});
```
-### ESM loader
-
-Lilconfig v2 does not support ESM modules out of the box. However, you can support it with a custom a loader. Note that this will only work with the async `lilconfig` function and won't work with the sync `lilconfigSync`.
-
-```js
-import {lilconfig} from 'lilconfig';
-
-const loadEsm = filepath => import(filepath);
-
-lilconfig('myapp', {
- loaders: {
- '.js': loadEsm,
- '.mjs': loadEsm,
- }
-})
- .search()
- .then(result => {
- result // {config, filepath}
-
- result.config.default // if config uses `export default`
- });
-```
-
## Version correlation
- lilconig v1 → cosmiconfig v6