Skip to content

Commit c261a14

Browse files
committed
review findings
1 parent b7ec307 commit c261a14

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/internal/modules/esm/get_format.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ function underNodeModules(url) {
9191
*/
9292
function detectModuleFormat(source, url) {
9393
try {
94-
let realSource = source ?? readFileSync(url, 'utf8');
95-
if (Buffer.isBuffer(realSource)) {
96-
// `containsModuleSyntax` requires source to be passed in as string
97-
realSource = realSource.toString();
98-
}
99-
return containsModuleSyntax(realSource, fileURLToPath(url), url) ? 'module' : 'commonjs';
94+
return containsModuleSyntax(source ?? readFileSync(url, 'utf8'), fileURLToPath(url), url) ? 'module' : 'commonjs';
10095
} catch {
10196
return 'commonjs';
10297
}

0 commit comments

Comments
 (0)