Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ESM "module":true projects #22

Open
josh-hemphill opened this issue Dec 21, 2022 · 1 comment
Open

Support ESM "module":true projects #22

josh-hemphill opened this issue Dec 21, 2022 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@josh-hemphill
Copy link

When loading *rc.js files that contain export const or export default results in failing with errors.

@azu azu added the help wanted Extra attention is needed label Dec 22, 2022
@azu
Copy link
Owner

azu commented Dec 22, 2022

rc-config-loader treat JS as CommonJS.
https://github.com/azu/rc-config-loader/blob/c4e335c2c02d347ef06f8cde9eb6efd216c0537a/src/rc-config-loader.ts#L171-L172C16

I have a feeling that if JS is to be treated as an ECMAScript Module, Dynamic Import will probably be required. It means that require Async API.
Also, It looks like VM APIs require async api.

Seems difficult to support right away.
rc-config-loader aim to get Sync APIs.

FYI: cosmiconfig will support ESM.
cosmiconfig/cosmiconfig#283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants