From 2082b0e4f3493860e76e2e873d8db8f51847581d Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Mon, 24 Jun 2024 21:27:17 -0700 Subject: [PATCH] This is a buffer here --- lib/internal/modules/esm/get_format.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js index 2bb6771503094d..bb0039c162c0b7 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js @@ -127,7 +127,7 @@ function getFileProtocolModuleFormat(url, context = { __proto__: null }, ignoreE // `source` is undefined when this is called from `defaultResolve`; // but this gets called again from `defaultLoad`/`defaultLoadSync`. if (getOptionValue('--experimental-detect-module')) { - const format = detectModuleFormat(source, url); + const format = detectModuleFormat(source?.toString(), url); if (format === 'module') { // This module has a .js extension, a package.json with no `type` field, and ESM syntax. // Warn about the missing `type` field so that the user can avoid the performance penalty of detection.