Skip to content

Commit

Permalink
fix: nested default exports with using dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Jan 18, 2024
1 parent cc99349 commit 9cf3e36
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/loader/built-in/module/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ export function toModuleRecord(
data: unknown,
) {
if (isESModule(data)) {
// @see https://github.com/testing-library/user-event/issues/813
// @see https://stackoverflow.com/questions/62717394/export-default-class-exports-double-nested-default
if (
isESModule(data.default) &&
data.default.default
) {
return {
...data,
default: data.default.default,
};
}

return data;
}

Expand Down

0 comments on commit 9cf3e36

Please sign in to comment.