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 configs #189

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Support ESM configs #189

merged 4 commits into from
Dec 15, 2023

Conversation

raphael-theriault-swi
Copy link
Member

Previously ESM projects could not use a JS config file because the loading code was always synchronous and always used required. Now it will be synchronous only when it needs to be and use dynamic asynchronous import otherwise

@raphael-theriault-swi raphael-theriault-swi requested a review from a team as a code owner December 15, 2023 18:35
/* eslint-disable-next-line @typescript-eslint/no-var-requires */
const required: unknown = require(file)

const fakeEsmDefaultExport =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe. Why is it "fake"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When TypeScript exports to CommonJS format it translates export default to a fake default like this, even though the format doesn't have that concept

@raphael-theriault-swi raphael-theriault-swi merged commit df8d7f5 into main Dec 15, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants