Skip to content

Commit 8f67069

Browse files
GeoffreyBoothdygabo
authored andcommitted
Don't return any format if containsModuleSyntax throws
1 parent 1770cd0 commit 8f67069

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/modules/esm/get_format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function detectModuleFormat(source, url) {
9292
return containsModuleSyntax(source, fileURLToPath(url), url) ? 'module' : 'commonjs';
9393
} catch {
9494
// containsModuleSyntax throws if source is undefined and the passed filename cannot be read
95-
return 'commonjs';
95+
// Return undefined so that the load hook can determine the format
9696
}
9797
}
9898

0 commit comments

Comments
 (0)