Skip to content

v2.0.5 Fixes async loaders πŸ‘‰ user defined ESM support

Compare
Choose a tag to compare
@antonk52 antonk52 released this 23 Mar 22:45
· 63 commits to master since this release

Thanks to @michael42 who reported and fixed a bug for async loaders in lilconfig function πŸ‘

You can now add support to ESM configs by providing a custom loader

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`
    });